On Sun, Jan 27, 2013 at 6:27 AM, Stephen Boesch <
jav...@gmail.com> wrote:
> Is this possible to do?
>
> I am using the following in the pom.xml, but in fact scala does NOT get
> compiled first, instead java does. The java has a scala dependency that I
> have commented out to allow this to work.
>
>
> <plugin>
> <groupId>net.alchim31.maven</groupId>
> <artifactId>scala-maven-plugin</artifactId>
> <version>3.1.0</version>
> <executions>
> <execution>
> <id>scala-compile-first</id>
> <phase>process-resources</phase>
> <goals>
> <goal>add-source</goal>
> <goal>compile</goal>
> </goals>
> </execution>
> <execution>
> <id>scala-test-compile</id>
> <phase>process-test-resources</phase>
> <goals>
> <goal>testCompile</goal>
> </goals>
> </execution>
> </executions>
> <configuration>
> <scalaVersion>2.9.2</scalaVersion>
> </configuration>
> </plugin>
>
> So there are three questions:
>
> a) why did scala get compiled second here - and how to make it really first
It should. I'll check with my test-case, and the various sample I have :
*
https://github.com/davidB/scala-maven-plugin/tree/master/src/it/testJavaAndScala
*
https://github.com/sonatype/m2eclipse-scala/tree/master/samples
Can you provide the log and the pom.xml ?
> b) any way to get java and scala compiled together
For mixed scala-java, the workflow is scala (1) ->java->scala (2)
During scala (1), scalac read .java and "imagine" the api and generate .class
During scala (2), scalac "check" api vs .class
If you try the new (experimental) incremental compiler based on zinc,
there is a better integration scala/java
> c) if (b) answer were 'no" then how to sequence a (1) scala phase A (2)
> java (3) scala phase B build , in which steps 1 and 3 apply to different
> source files. What I plan to do in that case is to partition the scala
> classes into (a) independent of java and (b) dependent on java pieces and
> sandwich the java compilation in between. It is not perfect that way, but i
> have a job to get done.
There is no compiler for both : answer is no, but you don't need to
split your project, you only need to split the compilation phase.
>
> --
>
>
>