When I create a Gradle project in Eclipse the result is a nested project with a -lib folder created automatically. Any ideas on why this is being created?
It is important to add the GRADLE_USER_HOME variable in Eclipse: Window->Preferences->Java->Build Path->Classpath Variable. Set it to the path of the ~/. gradle folder in your home directory (e.g. /home/<user_name>/. gradle/ (Unix) or C:\Users\<user_name>\.
Run Eclipse. Select the "File" > "Import" option from the menu: Select the "Gradle" > "Existing Gradle Project" option.
subprojects { sourceCompatibility = 11 } It adds the sourceCompatibility property to all sub-projects. This property is then used by the Gradle build Java Plugin: Java version compatibility to use when compiling Java source. Default value: version of the current JVM in use JavaVersion.
To create a new Gradle project with the Eclipse IDE, select the File New Other… menu entry and select Gradle/Gradle Project. Click on the Next > button. The wizard may show you a Welcome page, you can disable this via the _"Show the welcome page the next time the wizard appears" flag. The Next > button would allow to configure the project.
The Opens source project which creates this support itself is called Buildship and is led by Gradle Inc, the company behind the Gradle build framework. It is available on Buildship on Github. The tooling provides wizards for creating new Java based Gradle projects and options to execute Gradle build from the IDE.
The last Gradle version that does not result in a nested /lib project is 6.6.1. I set that as a specific Gradle version in Eclipse's preferences instead of the default Gradle wrapper. Sorry, something went wrong.
To run the build.gradle, open the command prompt and reach to the root directory of your project. And run the below command as below. Gradle provides command to configure classpath of the project for all jar dependency. In the Gradle script the below line is required.
I tested this on Eclipse 2021-03 using the latest gradle version 7.0-rc-1 and reproduced your issue where a nested project with a lib subproject was created. I then made a new Eclipse project specifying Gradle version 6.6 to be used and the resulting project was not nested. I suggest trying Gradle 6.6 and seeing if you get the same behavior I got. This might fix your project.
Also try running the gradle init
command from the command line and see what project structure you get there. I tested this on my PC where I have gradle 5.6 as the default version and got a non nested structure. You can of course always manually modify your gradle project in a few minutes to not be nested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With