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?
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.
Related
I have checked out a gradle project in eclipse but it is not able to recognise any annotation.Foe every annotation in each file it says
Configuration cannot be resolved to a
type
where configuration is annotation.
and all imports corresponding to annotation are also failing with following error:
The import org.springframework cannot be resolved
Entire project with all files is filled with error. But there is no such problem like this in Intellij for same project. Which setting am I missing for Eclipse ?
gradle build works fine although
From my experience, I did not see a checkout option in Eclipse for a Gradle project. I'm using Eclipse version 2019-06 (4.12.0). You need to check out the project in to your local file system and then do an import of the existing project as a Gradle Project.
Things to Note:
Make sure you have the Gradle buildship plugin installed in your Eclipse. (The plugin I use. Buildship: Eclipse Plug-ins for Gradle, provided as part of the Gradle Platform.)
Go to File --> Import. When a pop up box opens, scroll down to Gradle and select Existing Gradle project.
This Way Eclipse recognises the Gradle Project.
I'm using IntelliJ IDEA Community 2020.2.3.
My project is built around Kotlin 1.3.30 and Java 11.
I've upgraded one of my dependecy to java 11 too, and after that, the IDE shows the dependency under "External Libraries", it build the app without errors, Maven build it from terminal without error, but the IDE shows unresolved references on each occurrency of the classes, functions and imports of that library.
I already tried to empty the cache or deleting idea files and importing again the project, but none of those worked.
Any tips?
You can use CTRL+SHIFT+A and look for Load Maven Changes or CTRL+SHIRT+O to do the same thing
I'm trying to start some work on a Gradle project, but I get a strange error when attempting to build the project on my machine. Currently, we have a Gradle project that builds successfully for all other members of my team, all they need to do is clone the project and it builds without any problems. For myself, that isn't the case.
If I execute the gradle wrapper manually from the terminal:
./gradlew build
the project builds without any errors, but the Gradle synchronisation fails when importing the project into an IDE, giving the following error:
* What went wrong:
Could not resolve all dependencies for configuration ':billing-
provisioning-consumer-finance-details:compile'
I assume that it can't be a problem with the project structure, nor anything wrong with the build.gradle, since it builds without error on other machines.
So far I've tried:
Re-cloning the project (several times)
Clearing the gradle cache at ~/.gradle/caches
Clearing ~/.m2/repositories
Building the project in another IDE (Eclipse), which still gives the same error.
You can follow these steps :
Download Gradle from Gradle
Create or Export GRADLE_HOME as environment variable.Ex: E:\SoftwareRepo\building tools\gradle-4.4.1
Add to Path or Export Path Variable PATH=[YOUR GRADLE_HOME/bin] . ex. E:\SoftwareRepo\building tools\gradle-4.4.1\bin
Open cmd or terminal anywhere in your PC and run gradle --v . If gradle install successfully it will show installed gradle info.
Clone your gradle project
Go to project root directory. Open terminal and run gradle clean build
If there is still error then it will be probably your project is not correctly configured.
If you tried with intelij idea then you need to try this
File->Open. then select your source folder.
then a popup will come select local destribution gradle
PLEASE NOTE: THIS IS NOT A DUPLICATE. I want Gradle's IDEA plugin to correctly configure my IntelliJ IDEA CE project for me. I am not interested in any solution that involves manually tuning IntelliJ to find my JDK. This is a Gradle IDEA plugin feature that can and should work.
If you can find another question that involves correctly getting the Gradle IDEA plugin to configure IntelliJ (running on a Mac) so that it can find JDK 8+, then please by all means, mark this as a dupe and provide a link to that question. Otherwise, do not vote this as a dupe (it's not!).
Mac 10.9.5 here. Java 8 is my default JRE/JDK, and I just installed Groovy 2.4.6 and Gradle 2.13 via sdkman. I then installed IntelliJ IDEA CE.
On my terminal, I created a test-proj directory, and then inside that directory I issued the following Gradle command:
gradle init --type groovy-library
Gradle executed successfully, giving me a Groovy project skeleton. I then edited the generated build.gradle to contain the IDEA plugin:
apply plugin: 'idea'
And then I ran:
gradle wrapper
./gradlew clean idea
This generated the Gradle Wrapper for me, and I then used the IDEA plugin to generate IntelliJ project files for me. I then opened my brand-spanking-new IntelliJ IDE and went to Open my test-proj.
The project opened and everything appeared to be OK. But then I started coding and noticed that JRE classes such as String were not showing up as resolvable. So I went to File >> Project Structure and see this:
So it appears that IntelliJ can't find my default Java 8 JDK. I know the OS can find both the JRE and the JDK, based on the console ouput of java -version and javac -version. But something, between sdkman, Gradle or IntelliJ is preventing the IDE from finding Java. Any ideas?
I had the same problem, although i got it running by removing the .idea folder and reimporting the project by pointing to my build.gradle file. In the import dialog i selected the .ipr structure instead of using the idea "folder based structure" (default)
When executing gradle idea it will then generate an .ipr file in your project root configuring your project.
In my case the jdk was set properly and my modules were initialized correctly.
The reason behind using the .ipr files is, that the gradle idea plugin can't work with the directory based structure. See also:
directory based idea project with gradle
https://issues.gradle.org/browse/GRADLE-1041 (open for 6 years now)
Since i figured this out today i'm not sure how good this is working. Or what are the differences between directory based and .ipr based (.ipr based seems older?).
I'm using IntelliJ to work with a Gradle project. I noticed that whenever I try to refresh the Gradle project (or when trying to import/re-import a project as a Gradle project) I get the following error:
Error: Could not determine the Java version
$JAVA_HOME is set, the SDK is set to Java 8 (and gradle -version confirms it is also is set to Java 8), and the project builds fine from the command line. Restarting IntelliJ also does nothing. I also deleted the project specific and global .gradle folders, which did not resolve the issue.
I am running IntelliJ 14.1.4 on Ubuntu 15.04 and Gradle 2.5.
EDIT: Tried it on a different machine (also Ubuntu 15.04, Oracle Java 8) running IntelliJ 14.1.1 and it worked correctly.
I had this problem too. It seems it was linked to the project being setup with a rather old gradle build. Changing distributionUrl to a new distribution in /gradle//wrapper/gradle-wrapper.properties solved it
You should try to switch Idea boot jdk. It works for me.