[GRADLE-2588] Scala plugin eliminates javabuilder from eclipse .project file Created: 04/Dec/12  Updated: 21/Jan/13  Resolved: 21/Jan/13

Status: Resolved
Project: Gradle
Affects Version/s: 1.3
Fix Version/s: None

Type: Bug
Reporter: Andrew Declercq Assignee: Peter Niederwieser
Resolution: Cannot Reproduce Votes: 0


 Description   

When both the scala and java plugins are applied, only the scalabuilder is added to the eclipse .project file generated by the eclipse task.

This must be addressed manually in order for eclipse to be able to build.

INCORRECT VERSION:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>project</name>
<comment>project package</comment>
<projects/>
<natures>
<nature>org.scala-ide.sdt.core.scalanature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<buildSpec>
<buildCommand>
<name>org.scala-ide.sdt.core.scalabuilder</name>
<arguments/>
</buildCommand>
</buildSpec>
<linkedResources/>
</projectDescription>

CORRECT VERSION:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>project</name>
<comment>project package</comment>
<projects/>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.scala-ide.sdt.core.scalanature</nature>
</natures>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name> <----- missing
<arguments/>
</buildCommand>
<buildCommand>
<name>org.scala-ide.sdt.core.scalabuilder</name>
<arguments/>
</buildCommand>
</buildSpec>
<linkedResources/>
</projectDescription>



 Comments   
Comment by Peter Niederwieser [ 11/Dec/12 ]

I cannot reproduce this. What I'm observing is that a mixed Java/Scala project works fine with just the Scala builder, and stops working once a Java builder is added. The "Scala Project" wizard also just adds a Scala builder. Tested with Gradle 1.3 and Scala IDE 2.1-m2.

Comment by Andrew Declercq [ 16/Jan/13 ]

Could you tell me how you setup your test?

In our project, the java files are in src/main/java and the scala files are in src/main/scala,
but the scala and java classes are interdependent.
I haven't been able to find much in terms of best practices for this case,
but one reference suggested that the best thing to do was to alter paths so
that the scala compiler/builder did all of the work.

Thanks

Comment by Peter Niederwieser [ 21/Jan/13 ]

If you keep Java/Scala sources with bidirectional dependencies in separate source roots, you'll have to declare `src/main/java` as a Scala source dir in the Gradle build script, and remove it as a Java source dir. However, this shouldn't have an influence on Eclipse.

I'll close this issue because I think it's correct to only add a Scala builder. If you disagree, please open another issue and attach a self-contained project that allows to reproduce the problem.

Generated at Wed Jun 30 12:26:01 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.