Re: [maven-and-scala] Scala 2.10.x and Multiple Versions warning

6,434 views
Skip to first unread message

Josh Suereth

unread,
May 28, 2013, 5:56:55 PM5/28/13
to maven-a...@googlegroups.com
Not currently, but patches welcome!


On Tue, May 28, 2013 at 5:00 PM, <thomas...@pnnl.gov> wrote:
I am seeing warnings with scala-maven-plugin 3.1.5 such as:

Expected all dependencies to require Scala version: 2.10.1
 c.b.a:x:2-SNAPSHOT requires scala version: 2.10.1
 f.e.d:y:1-SNAPSHOT requires scala version: 2.10.0
Multiple versions of scala libraries detected!

Except scala 2.10.0 and 2.10.1 and 2.10.x are binary compatible. Is there a way to suppress this warning?

--
 
---
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 maven-and-sca...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

David Bernard

unread,
May 28, 2013, 6:28:07 PM5/28/13
to Maven and Scala

Workaround : disable the check

http://davidb.github.io/scala-maven-plugin/compile-mojo.html#checkMultipleScalaVersions

2.10.1 and 2.10.0 are the first binary compatible version at major.minor level

m...@41concepts.com

unread,
Oct 16, 2013, 5:09:06 AM10/16/13
to maven-a...@googlegroups.com
A little late I know, but I got the same problem today with scala test using older scala 2.10.0 instead of scala 2.10.3 and seemingly got it solved by using maven exclude. I.e.

<dependencies>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>2.10.3</version>
        </dependency>
        <dependency>
              <groupId>org.scalatest</groupId>
              <artifactId>scalatest_2.10</artifactId>
              <version>2.0.RC2</version>
              <scope>test</scope>
              <exclusions>
                  <exclusion>
                      <!-- make sure wrong scala version is not pulled in -->
                      <groupId>org.scala-lang</groupId>
                    <artifactId>scala-library</artifactId>
                  </exclusion>
              </exclusions>
        </dependency>
 </dependencies>

David Bernard

unread,
Oct 16, 2013, 7:06:56 AM10/16/13
to Maven and Scala
Since scala-maven-plugin 3.1.6 you can define scalaCompatVersion (via property or configuration)

So you can try <scalaCompatVersion>2.10</scalaCompatVersion>


--

Eyal Farago

unread,
Dec 25, 2013, 5:15:10 AM12/25/13
to maven-a...@googlegroups.com
David, 
I couldn't get this to work, can you explain where should this be added? is this a property or a configuration of the plug-in?

one more thing,
in my organization, the scala plugin is configured in the org-pom, all projects inherit the org-pom as their parent (or ancestor).
I've tried adding youre suggetion as a property in one of the deriving poms - no go :-(
does it have to go in the org-pom? is this supposed to be a child element of the scala-plugin? (doesn't make sense as the Scala.version is a property).

thanks,
Eyal.

David Bernard

unread,
Dec 25, 2013, 8:32:13 AM12/25/13
to Maven and Scala
Hi,

Use <scalaCompatVersion>2.10</scalaCompatVersion> as child of <configuration> for the scala-maven-plugin.
Or define the property : scala.compat.version (see http://davidb.github.io/scala-maven-plugin/compile-mojo.html#scalaCompatVersion) from command line or as child of <properties>

Hope it's clearer.

Eyal Farago

unread,
Dec 25, 2013, 11:49:56 PM12/25/13
to maven-a...@googlegroups.com
Defining it as a property didn't make any difference,I'll try the configuration approach later today when I make it to the office.

Does specifying the exact scala version shaddows the compatability version?

Eyal.

David Bernard

unread,
Dec 26, 2013, 5:57:58 AM12/26/13
to Maven and Scala
Can you send
* the console output with the error messages
* the fragment of pom with properties, dependencies, plugin configuration


Eyal Farago

unread,
Dec 30, 2013, 6:27:47 AM12/30/13
to maven-a...@googlegroups.com
Hi David,
I'm attaching the relevant parts of the effective pom (as dumped by mvn help:effective-pom) and the build output, as you can see configuring the scalaCompatVersion is not working (I also attempted the property approach), the warning still pops up.

I'd appreciate your assistance.

in section build/pluginManagement:
<plugin>
        <groupId>net.alchim31.maven</groupId>
        <artifactId>scala-maven-plugin</artifactId>
        <version>3.1.5</version>
        <executions>
          <execution>
            <id>compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
            <configuration>
              <scalaCompatVersion>2.10</scalaCompatVersion>
              <args>
                <arg>-deprecation</arg>
                <arg>-feature</arg>
              </args>
            </configuration>
          </execution>
          <execution>
            <id>test-compile</id>
            <phase>test-compile</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>
            <configuration>
              <scalaCompatVersion>2.10</scalaCompatVersion>
              <args>
                <arg>-deprecation</arg>
                <arg>-feature</arg>
              </args>
            </configuration>
          </execution>
          <execution>
            <id>processResources</id>
            <phase>process-resources</phase>
            <goals>
              <goal>compile</goal>
            </goals>
            <configuration>
              <scalaCompatVersion>2.10</scalaCompatVersion>
              <args>
                <arg>-deprecation</arg>
                <arg>-feature</arg>
              </args>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <scalaCompatVersion>2.10</scalaCompatVersion>
          <args>
            <arg>-deprecation</arg>
            <arg>-feature</arg>
          </args>
        </configuration>
      </plugin>

in properties:
<scala.compat.version>2.10</scala.compat.version>
<scala.version>2.10.3</scala.version>

build output:
eyal@ilpceyalf ~/actimize_slns/bs_infra2/bs_infra/bs_infra_pure (SR133899_scala_2_10) $ mvn clean compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building infra_pure 2.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ bs_infra_pure ---
[INFO] Deleting F:\actimize_slns\bs_infra2\bs_infra\bs_infra_pure\target
[INFO]
[INFO] --- maven-enforcer-plugin:1.2:enforce (enforce-java) @ bs_infra_pure ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.2:enforce (enforce-ais) @ bs_infra_pure ---
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ bs_infra_pure ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory F:\actimize_slns\bs_infra2\bs_infra\bs_infra_pure\src\main\resources
[INFO]
[INFO] --- scala-maven-plugin:3.1.5:compile (processResources) @ bs_infra_pure ---
[WARNING]  Expected all dependencies to require Scala version: 2.10.3
[WARNING]  org.scalatest:scalatest_2.10:2.0 requires scala version: 2.10.0
[WARNING] Multiple versions of scala libraries detected!
[INFO] F:\actimize_slns\bs_infra2\bs_infra\bs_infra_pure\src\main\java:-1: info: compiling
[INFO] F:\actimize_slns\bs_infra2\bs_infra\bs_infra_pure\src\main\scala:-1: info: compiling
[INFO] Compiling 27 source files to F:\actimize_slns\bs_infra2\bs_infra\bs_infra_pure\target\classes at 1388402603472

David Bernard

unread,
Dec 30, 2013, 6:50:54 AM12/30/13
to Maven and Scala
"Since scala-maven-plugin 3.1.6 you can define scalaCompatVersion (via property or configuration)"

You use version 3.1.5

Eyal Farago

unread,
Dec 30, 2013, 7:06:06 AM12/30/13
to maven-a...@googlegroups.com
just figured out myself (-X do some magic), you beat me to the browser :-)
thanks for the quick reply.

David

unread,
Dec 3, 2014, 8:55:06 PM12/3/14
to maven-a...@googlegroups.com
Hi,

I do this:

<configuration>
       
<scalaCompatVersion>2.10</scalaCompatVersion>
       
<scalaVersion>2.10.4</scalaVersion>
   
</configuration>
</plugin>


and then get this:

[WARNING]  com.typesafe.akka:akka-actor_2.11:2.3.6 requires scala version: 2.11.2
[WARNING] Multiple versions of scala libraries detected!


There is no place in my pom.xml where I specify the akka-actor version.

Can someone tell me where alchim31 might be picking up this version of akka-actor?



On Tuesday, May 28, 2013 5:00:27 PM UTC-4, thomas...@pnnl.gov wrote:
I am seeing warnings with scala-maven-plugin 3.1.5 such as:

Expected all dependencies to require Scala version: 2.10.1
 c.b.a:x:2-SNAPSHOT requires scala version: 2.10.1
 f.e.d:y:1-SNAPSHOT requires scala version: 2.10.0
Multiple versions of scala libraries detected!

David Bernard

unread,
Dec 4, 2014, 1:53:34 AM12/4/14
to Maven and Scala
Hi,

you can run

   mvn dependency:tree

see http://maven.apache.org/plugins/maven-dependency-plugin/index.html for details

--

---
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 maven-and-sca...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages