build.gradle has duplicate entries when re-creating project
Old hand at Java, but new IntelliJ and also new to Gradle. Trying to learn all about creating a new project. I'm going through the "new project" steps and blowing away the content to "try again".
The build.gradle file grows each time with duplicate entries.
1. Starting with a clean directory, I start IntelliJ IDEA
2. From the "Welcome" dialog, I select "create new project"
3. I select "Gradle" (on the left) and "Java" for the additional framework. Then Next.
4. I populate the GroupId and ArtifactId fields. Then Next.
5. I'm not changing anything else in the next screen (and also don't have the "create empty directories" option as others have cited). Then Next.
6. I accept the project name and location defaults. Then Finish.
7. The main window opens with a handful of initial files and directories.
a. .gradle, .idea, gradle directories
b. build.gradle, gradlew, gradlew.bat, settings.gradle files
c. NO folders created for src/main, src/main/java, src/test, etc.
Eventually I find the guidance (on this forum, thank you) that the "create empty directories" option is now inside: Preferences | Build, Execution, Deployment | Gradle. I want to start over and try this option.
8. I quit IntelliJ IDEA.
9. From a command line, I go to the project location and "rm -rf" the directory.
10. Then I repeat steps 1 - 7 above.
This is where things get screwy.
1. The empty directories are still not created, and
2. Every line in the build.gradle file has duplicate entries:
plugins {
id 'java'
}
plugins {
id 'java'
}
group 'com.asdf'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}
group 'asdf'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}
If I repeat the same steps (rm -rf, through re-creating the project), then I get three copies and so on. It seems like the build.gradle content is cached somewhere other than the project location and persists beyond my "rm -rf" step.
Where/how can I clean things to start over?
IntelliJ IDEA 2019.1.3 (Community Edition)
Build #IC-191.7479.19, built on May 28, 2019
JRE: 1.8.0_202
MacOS Mojave
Please sign in to leave a comment.
It is known issue, please feel free to follow it in tracker: https://youtrack.jetbrains.com/issue/IDEA-184999
Thank you. I assumed I was doing something stupid... :)