Cross compiling Scala jars with

Skip to first unread message

Mark Butler

May 12, 2015, 1:12:22 PM5/12/15

I want to cross compile a Scala jar using the Scala Maven plugin. I am following the instructions here:

However it does not make the artifact id correctly - if I take this approach:


Then if scalaVersion is defined in pom.xml - for example if I give it an initial value then override it with the profile - it takes the initial value, not the version supplied at the command line via:

     mvn -DscalaVersion=2.11

My initial value was 2.10 so I keep getting error messages like this when I try to use the jar:

   > inconsistent module metadata found. 
   Descriptor: myorg:myjar_2.10:0.1-SNAPSHOT 
   Errors: bad module name: expected='myjar_2.11' found='myjar_2.10'

If I don't give it an initial value then this happens:

   > inconsistent module metadata found. 
   Descriptor: myorg:myjar_${scalaVersion}:0.1-SNAPSHOT 
   Errors: bad module name: expected='myjar_2.11' found='myjar_${scalaVersion}'

Maybe something changed in Maven since David wrote his FAQ?

Does anybody know any way around this? I tried searching Github but I couldn't find any example of using Maven to cross compile for Scala.



David Bernard

May 13, 2015, 3:46:46 AM5/13/15
to Maven and Scala

Can you share a sample project on github/bitbucket, then we can iterate on an uptodate solution ?
Which version of maven do you use ?


You received this message because you are subscribed to the Google Groups "Maven and Scala" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

Reply all
Reply to author
0 new messages