vscode-java
vscode-java copied to clipboard
Feature Request: configurable `defaultOutputDir` instead of hardcoded `bin`
Feature Request
Please provide a configuration to change defaultOutputDir bin
Detail
I'm not an eclipse user, as I know, bin is widely used as a dir that stores shell scripts, but vscode java plugin uses it as the default output dir, and can not be changed by configuration, the only way I know is using gradle eclipse plugin to generate .classpath with modified config by groovy script in build.gradle, see #634
buildDir = "build/gradle"
apply plugin: 'java'
apply plugin: 'eclipse'
eclipse {
classpath {
defaultOutputDir = file('build/eclipse')
file.whenMerged {
entries.each { entry ->
if (entry.kind == 'src' && entry.hasProperty('output')) {
entry.output = entry.output.replace('bin/', "build/eclipse/")
}
}
}
}
}
@jdneo https://github.com/redhat-developer/vscode-java/issues/2801#issuecomment-1318256946
You can vote for https://github.com/redhat-developer/vscode-java/issues/1615 to help us prioritize.
If anyone encounter this issue, please comment / give 👍 / link related issue to this one, to help the team escalate the priority of this issue.
This would also be useful for projects that do not use any build manager. Currently no .classpath files are generated by vscode-java (which is good but removes any configuration tweaking) and built files seems to be saved in the workspace metadata folder (which I would like to change).
I would like to use vscode as my "build system" for one project as it is very easy to import .jar files in the classPath using the java.project.referencedLibraries property. But I also need to easily access the .class files.
Having a java.project.defaultOutputDir property that I could also set in my .vscode/config.json would enable me to save all the .class files in a directory of my choice.
CC @jdneo, since he is working on tuning the classpath configuration UX.
@jdneo Could you please have a look on this issue?
@n-peugnet The newest Language support for Java extension adds a new setting to set the output path for project without any build tools.
java.project.outputPath: A relative path to the workspace where stores the compiled output. Only effective in the WORKSPACE scope. The setting will NOT affect Maven or Gradle project.
@pan3793 Sorry currently there is no plan to make that setting be able to impact Maven/Gradle project. But we will keep an eye on this request.
it's been one year
can someone help me out?
Really need this feature since our repo got bin/ for scripts.
here's the kotlin script version of the workaroud:
import org.gradle.plugins.ide.eclipse.model.Classpath
import org.gradle.plugins.ide.eclipse.model.SourceFolder
plugins {
java
eclipse
}
buildDir = file("build/gradle")
eclipse {
classpath {
defaultOutputDir = file("build/eclipse")
file {
whenMerged(
Action<Classpath> { ->
entries.filter { it.kind == "src" }.forEach {
if (it is SourceFolder) {
it.output = it.output.replace("bin/", "build/eclipse/")
}
}
}
)
}
}
}
This buildship output folder issue is really annoying. It would be great to have a setting to be able to impact Maven/Gradle projects.
@jdneo https://github.com/redhat-developer/vscode-java/issues/2801#issuecomment-1318256946
You can vote for https://github.com/redhat-developer/vscode-java/issues/1615 to help us prioritize.
If anyone encounter this issue, please comment / give 👍 / link related issue to this one, to help the team escalate the priority of this issue.
I onboard people at work. This issue confuses people and ultimately causes people to uninstall the extension.
If you guys feel strongly about this issue, please vote for https://github.com/gradle/gradle/issues/23032. We can't do anything until this is fixed upstream.
It would be good to prompt the user before downloading huge amounts of data and kicking off a resource intensive compile.
How do we prevent this extension from automatically building a project?
If you guys feel strongly about this issue, please vote for gradle/gradle#23032. We can't do anything until this is fixed upstream.
It seems that there are related commit on gradle recently, see https://github.com/gradle/gradle/issues/23032, hope it can be applied to the plugin.
23032 is "Complete" with no indication of a resolution. Are we still blocked by upstream? Does no one care that stupid files are being created incorrectly? Humans are too adaptable - too quick to "resolve" an issue with a workaround, instead of fixing the real problem. One dev fixes this and hundreds of teams get to stop being annoyed. WTF! This whole thing has been going on for almost 3 years. Abhorrent community support - all around.
for anyone who is still encountering this issue, a workaround:
- use Gradle wrapper 8.1+
- in
build.gradle, apply plugineclipse, and add the following snippet
eclipse {
classpath {
baseSourceOutputDir = file('build')
}
}
then the class files are generated in build folder.
for anyone who is still encountering this issue, a workaround:
- use Gradle wrapper 8.1+
- in
build.gradle, apply plugineclipse, and add the following snippeteclipse { classpath { baseSourceOutputDir = file('build') } }then the class files are generated in
buildfolder.
That doesn't work for me.
That doesn't work for me.
After applying the patch, reset your LS by using "Java: Clean Java Language Server Workspace"
for anyone who is still encountering this issue, a workaround:
- use Gradle wrapper 8.1+
- in
build.gradle, apply plugineclipse, and add the following snippeteclipse { classpath { baseSourceOutputDir = file('build') } }then the class files are generated in
buildfolder.That doesn't work for me.
This works, but adding it to build.gradle only for VS users and having 3 versions of everything in the build dir is quite suboptimal, gradle seems to be a second class citizen atm
I use nvim-jdtls and I can use spring-boot-devtools with this configuration:
eclipse {
classpath {
baseSourceOutputDir = file('build/classes/java')
}
}