Vscode-java: Don't create any files in project source dir - use alternative location

Created on 15 Mar 2018  路  10Comments  路  Source: redhat-developer/vscode-java

Presently, vscode-java is prone to creating large amount of temporary files right in the middle of project source. Those include copies of compiled classes and eclipse project files (the whole unfortunate eclipse deal).

In some cases it is very desirable to keep the project directory "clean" from unmanaged files (given that the build system is able to build elsewhere). Is it possible to add an option to vscode-java forcing an alternative location for all those temporary files?

Most helpful comment

Gradle projects default their builds to build/, however the vscode plugin compiles a completely separate version of all the class files to bin/, so it does require adding a completely separate directory to source control, along with actually performing all the compiles twice (once for gradle, and once for vscode).

All 10 comments

no, we don't have control over those eclipse generated files. Simply add them to your SCM ignore list

also "large amount of temporary files"? compiled classes should not be under your source directories, but a build folder (bin or target). If not then I'd like to see your .classpath file

In some of my projects maven output is controlled via custom property. Clearly, vscode has no idea about those properties, so it happily creates folders named "${property.name} and so. This is exceptionally annoying.

@oakad please provide a sample project reproducing this behavior

For example, a maven file set like so (assuming maven integration is enabled):

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>some</groupId>
  <artifactId>project</artifactId>
  <version>1.0</version>
  <build>
   <directory>${target.dir}</directory>
  </build>
 </project>

(Suppose, I will disable maven integration outright and fix the eclipse files manually).

How do you expect target.dir to be set?

I checked that if target.dir is defined as a project property, or in an active profile of settings.xml. it'll be resolved properly and the build directory generated as expected

Gradle projects default their builds to build/, however the vscode plugin compiles a completely separate version of all the class files to bin/, so it does require adding a completely separate directory to source control, along with actually performing all the compiles twice (once for gradle, and once for vscode).

In this particular case the property was supposed to be injected by higher level cmake, so settings.xml was not present.

I just ignore those files from scm by adding ignore file

git config --global core.excludesfile ~/.gitignore

and add rules to ~/.gitignore

**/*.project
**/*.factorypath
**/*.settings
**/*.classpath
Was this page helpful?
0 / 5 - 0 ratings