3

Since some Gradle version, it doesn't create "flat projects" any more. Instead you always get an empty "wrapper" project with the actual project name ("myproject") which includes a sub project always named lib or app, depending on whether you choose --type java-library or --type java-application. The sub project, e.g. lib, is the "actual" project / module.

For my application I maintain a framework, let's say "my_framework" which contains a lot of sub projects "database", "config", "webhelp", ... These sub projects directly contain the code. I include them in the settings.gradle file like my_framework:database. This structure was created a few years ago using Eclipse and the Gradle version of that time.

Now, when I try to add more sub projects, I will get an empty wrapper project with the intended name (e.g. stats2json) and another nested sub project always named lib. I will have to include my_framework:database:lib.

This makes the project tree in Eclipse more unclear and I do not really understand this change. Did I do something wrong some years ago? Or is the mandatory lib/app sub project, I'm dealing with currently, result of a wrong approach?

Is there gradle init --type java-library-**subproject**?

I use the current Eclipse version and Gradle 7.x. I tried to create new sub projects (1) using Eclipse's "new gradle project" wizard and (2) using the command line gradle in a manually created empty sub project directory. But results are the same.

MrSnrub
  • 1,123
  • 1
  • 11
  • 19
  • 1
    Have you managed to resolve this issue? Im facing the same problem right now – Patrick Nov 07 '22 at 22:21
  • I have done an archeological dig into this. The pull request https://github.com/gradle/gradle/pull/14210 is where it happened (Aug 2020). I could not trace back to find out why the change was made. The feature branch that might have given the issue reference was deleted. Based on the conversation, what you want might be the "basic" project type. – Emma Atkinson Jan 16 '23 at 10:43
  • I think I have found the issue. https://github.com/gradle/gradle/issues/14305 – Emma Atkinson Jan 16 '23 at 10:59
  • @EmmaAtkinson Thanks for your research! At the moment I use `--type=basic` to create my sub projects and do everything else manually. I wonder if there is a "suggested approach" for the scenario of a larger JAVA library project with several sub projects that should not contain nested "lib" or "app" sub sub projects. Why would everyone with a Java project want *every* sub project to contain another "lib" or "app" sub sub project?! I'm still irritated by this "feature". – MrSnrub Jan 16 '23 at 17:29

0 Answers0