Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Gradle Wizard creates project with SubFolder -lib

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?

enter image description here

like image 496
stuart Avatar asked Feb 02 '21 07:02

stuart


People also ask

How do I set the gradle home directory in Eclipse?

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>\.

How do I import a nested gradle project into Eclipse?

Run Eclipse. Select the "File" > "Import" option from the menu: Select the "Gradle" > "Existing Gradle Project" option.

What is subproject in gradle?

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.

How to create a Gradle project with Eclipse IDE?

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.

Where can I find the Gradle build framework tooling?

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.

Which Gradle version does not result in a nested/Lib project?

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.

How do I run a Gradle build from a JAR file?

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.


Video Answer


1 Answers

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.

like image 69
Ruskin Janowski Avatar answered Oct 16 '22 21:10

Ruskin Janowski