Hi,
It's not easy, and I don't remember if the result works for every case. But it's what I did :
* modify pom.xml
* produce artifact include scala version :
<artifactId>scala-maven-plugin_${scalaVersion}</artifactId>
* dependencies available in every value of scalaVersion
<dependencies>
<dependency>
<groupId>y.x</groupId>
<artifactId>z_${scalaVersion}</artifactId>
<version>0.0</version>
</dependency>
* dependencies available for specific scalaVersion should be part of profile section
<profile>
<id>scala-2.9.0</id>
<activation>
<property>
<name>scalaVersion</name>
<value>2.9.0</value>
</property>
</activation>
<dependencies>
...
* source specific to a scalaVersion (api of dependencies like scala-library can be different)
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/scala_${scalaVersion}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
* to run this pom.xml you have to always define scalaVersion on the call of maven (due to scalaVersion into the package name) so to build your project you will run maven several time :
#! /bin/sh
for v in 2.8.1 2.9.1 2.9.2 ; do
mvn -DscalaVersion=$v $*
done
I hope this will help you (I write it from old code and from memory, fix/feedback welcome) . I'll copy this response to the FAQ (and later to the doc) so tell me if it works (or not).
/davidB
On Wed, Oct 31, 2012 at 8:17 PM, Chris Riccomini
<cricc...@gmail.com> wrote:
Hey Guys,
Is it possible to cross build a project for scala 2.8.1, 2.9.2, and 2.10 using scala-maven-plugin?
I can't really find any examples or documentation on this.
Thanks!
Chris