Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: configurable defaultOutputDir instead of hardcoded bin #1615

Open
pan3793 opened this issue Sep 15, 2020 · 20 comments
Open

Comments

@pan3793
Copy link

pan3793 commented Sep 15, 2020

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 #2801 (comment)

You can vote for #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.

@n-peugnet
Copy link

n-peugnet commented Oct 13, 2020

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.

@testforstephen
Copy link
Collaborator

CC @jdneo, since he is working on tuning the classpath configuration UX.

@pan3793
Copy link
Author

pan3793 commented Mar 9, 2021

@jdneo Could you please have a look on this issue?

@jdneo
Copy link
Collaborator

jdneo commented Mar 9, 2021

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

@BrightTreeMan
Copy link

it's been one year

@BrightTreeMan
Copy link

can someone help me out?

@kid1412621
Copy link

Really need this feature since our repo got bin/ for scripts.

@sify21
Copy link

sify21 commented Nov 3, 2022

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/")
                            }
                        }
                    }
            )
        }
    }
}

@a-st
Copy link

a-st commented Nov 17, 2022

This buildship output folder issue is really annoying. It would be great to have a setting to be able to impact Maven/Gradle projects.

@pan3793 pan3793 changed the title Feature Request: Please provide a property in configuration to change defaultOutputDir bin Feature Request: Please provide a configuration to change defaultOutputDir bin Nov 17, 2022
@pan3793 pan3793 changed the title Feature Request: Please provide a configuration to change defaultOutputDir bin Feature Request: configurable defaultOutputDir instead of hardcoded bin Nov 17, 2022
@pan3793
Copy link
Author

pan3793 commented Nov 17, 2022

@jdneo #2801 (comment)

You can vote for #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.

@gardner
Copy link

gardner commented Nov 21, 2022

I onboard people at work. This issue confuses people and ultimately causes people to uninstall the extension.

@fbricon
Copy link
Collaborator

fbricon commented Dec 7, 2022

If you guys feel strongly about this issue, please vote for gradle/gradle#23032. We can't do anything until this is fixed upstream.

@gardner
Copy link

gardner commented Dec 28, 2022

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?

@Kicey
Copy link

Kicey commented Feb 12, 2023

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 gradle/gradle#23032, hope it can be applied to the plugin.

@dailytabs
Copy link

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.

@CsCherrYY
Copy link
Contributor

for anyone who is still encountering this issue, a workaround:

  • use Gradle wrapper 8.1+
  • in build.gradle, apply plugin eclipse, and add the following snippet
eclipse {
  classpath {
    baseSourceOutputDir = file('build')
  }
}

then the class files are generated in build folder.

@Michel73
Copy link

for anyone who is still encountering this issue, a workaround:

  • use Gradle wrapper 8.1+
  • in build.gradle, apply plugin eclipse, and add the following snippet
eclipse {
  classpath {
    baseSourceOutputDir = file('build')
  }
}

then the class files are generated in build folder.

That doesn't work for me.

@Kamii0909
Copy link

That doesn't work for me.

After applying the patch, reset your LS by using "Java: Clean Java Language Server Workspace"

@kdaham
Copy link

kdaham commented Sep 27, 2023

for anyone who is still encountering this issue, a workaround:

  • use Gradle wrapper 8.1+
  • in build.gradle, apply plugin eclipse, and add the following snippet
eclipse {
  classpath {
    baseSourceOutputDir = file('build')
  }
}

then the class files are generated in build folder.

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

@ramonbakker
Copy link

I use nvim-jdtls and I can use spring-boot-devtools with this configuration:

eclipse {
    classpath {
        baseSourceOutputDir = file('build/classes/java')
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests