VS code java creates duplicate classes in Java project with Gradle build
See original GitHub issueEnvironment
- Operating System: Linux 3.10.0-957.21.3.el7.x86_64 #1 SMP Fri Jun 14 02:54:29 EDT 2019 x86_64 x86_64 x86_64 GNU/Linux
- JDK version: 1.8.0_151
- Visual Studio Code version: 1.40.2
- Java extension version: 0.54.2
- Gradle version: 6.0.1
Steps To Reproduce
- Create a default Java application with Gradle:
$ mkdir java-simple-app
$ cd java-simple-app/
$ gradle init
Select type of project to generate:
1: basic
2: application
3: library
4: Gradle plugin
Enter selection (default: basic) [1..4] 2
Select implementation language:
1: C++
2: Groovy
3: Java
4: Kotlin
5: Swift
Enter selection (default: Java) [1..5]
Select build script DSL:
1: Groovy
2: Kotlin
Enter selection (default: Groovy) [1..2]
Select test framework:
1: JUnit 4
2: TestNG
3: Spock
4: JUnit Jupiter
Enter selection (default: JUnit 4) [1..4]
Project name (default: java-simple-app):
Source package (default: java.simple.app): org.my.app
> Task :init
Get more help with your project: https://docs.gradle.org/6.0.1/userguide/tutorial_java_projects.html
BUILD SUCCESSFUL in 37s
2 actionable tasks: 2 executed
- Open the newly created project with vscode, wait for “Language Support for Java™ by Red Hat” extension to initialize project
- Check the project folder tree:
java-simple-app/
|-- bin
| |-- main
| | `-- org
| | `-- my
| | `-- app
| | `-- App.class
| `-- test
| `-- org
| `-- my
| `-- app
| `-- AppTest.class
|-- build
| |-- classes
| | `-- java
| | |-- main
| | | `-- org
| | | `-- my
| | | `-- app
| | | `-- App.class
| | `-- test
| | `-- org
| | `-- my
| | `-- app
| | `-- AppTest.class
| |-- generated
| | `-- sources
| | `-- annotationProcessor
| | `-- java
| | |-- main
| | `-- test
| |-- reports
| | `-- tests
| | `-- test
| | |-- classes
| | | `-- org.my.app.AppTest.html
| | |-- css
| | | |-- base-style.css
| | | `-- style.css
| | |-- index.html
| | |-- js
| | | `-- report.js
| | `-- packages
| | `-- org.my.app.html
| |-- test-results
| | `-- test
| | |-- binary
| | | |-- output.bin
| | | |-- output.bin.idx
| | | `-- results.bin
| | `-- TEST-org.my.app.AppTest.xml
| `-- tmp
| |-- compileJava
| `-- compileTestJava
|-- build.gradle
|-- gradle
| `-- wrapper
| |-- gradle-wrapper.jar
| `-- gradle-wrapper.properties
|-- gradlew
|-- gradlew.bat
|-- settings.gradle
`-- src
|-- main
| |-- java
| | `-- org
| | `-- my
| | `-- app
| | `-- App.java
| `-- resources
`-- test
|-- java
| `-- org
| `-- my
| `-- app
| `-- AppTest.java
`-- resources
54 directories, 23 files
Question
The ‘build’ dir is from Gradle build task and its content looks similar to the ‘bin’ dir, which is generated by the extension. What is this ‘bin’ dir for?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Android Studio: Resolving Duplicate Classes - gradle
Sometimes duplicate classes exception means that one of your dependencies uses ... that AGP gets both build/classes/java/main and build/libs/lib.jar (run .
Read more >How to avoid duplicate classes for build types ?
My idea is to redefine some classes and layouts in the admin folder, in order to add special capabilities. But when I launch...
Read more >Shrink, obfuscate, and optimize your app
Learn how to shrink code in your release build to remove unused code and resources.
Read more >Maven and Gradle support for Java in Visual Studio Code
The extension provides a visual interface for your Gradle build, you can use this interface to view Gradle Tasks and Project dependencies, or...
Read more >Upgrading your build from Gradle 5.x to 6.0
The usage of the compile and runtime configurations in the Java ecosystem ... this from happening accidentally, encountering duplicates while creating an ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I ended with this configuration in my build.gradle so gradle build on “build/gradle” and eclipse on “build/eclipse”:
@snjeza perfect! This is what we needed, thank you very much!