When buildship imports a java project it doesn't change the "Build Path" output folder


(Steve Cohen) #1

Eclipse, by default, puts compiler output in /bin, whereas gradle puts it in /build/classes. This means that if you have Project->Build Automatically on and you Clean the project from the menu, output will go in /bin, but if you do these things from the Gradle Task View, it will go to /build/classes. This can get confusing. You can of course change the output folder in the BuildPath tool of Eclipse, to try to keep the two in synch, but this goes into the .classpath file, which arguably should not be version controlled. And even if it is version controlled, if someone imports the project into eclipse, I think the Buildship importer will undo this.

I don’t understand why the Buildship importer doesn’t set the default output path to /build/classes. There may be a perfectly good reason for that, but I would like to know if there is recommended buildship practice for handling this.


On buildship project imports, java buildpath output folder is left as bin
Coexist with Maven? Looking for a strategy
(Stefan Oehme) #2

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=488015. Once that is implemented, you can set it to whatever you wish.

The default is a different folder, because that’s where all code ends up in Eclipse, no matter if production or test. If that folder pointed to build/classes/main, that would completely screw up incremental compilation in Gradle.

There are ways around this, Eclipse has the ability to specify the output folder separately for each source folder. This is something that would have to be fixed in Gradle core first and could then be exposed to Buildship.