maven:构建期间的版本冲突

时间:2015-09-12 19:32:46

标签: java scala maven

我在我的" mvn clean install"中遇到了以下警告:

[WARNING]  org.scalatest:scalatest_2.10:2.2.1 requires scala version: 2.10.4
[WARNING]  com.github.scopt:scopt_2.10:3.3.0 requires scala version: 2.10.4
[WARNING]  org.apache.spark:spark-streaming_2.10:1.3.1 requires scala version: 2.10.4
[WARNING]  org.apache.spark:spark-catalyst_2.10:1.3.1 requires scala version: 2.10.4
[WARNING]  org.scala-lang:scala-compiler:2.10.4 requires scala version: 2.10.4
[WARNING]  org.scala-lang:scala-reflect:2.10.4 requires scala version: 2.10.4
[WARNING]  org.scalamacros:quasiquotes_2.10:2.0.1 requires scala version: 2.10.4
[WARNING]  org.scalanlp:breeze_2.10:0.11.2 requires scala version: 2.10.4
[WARNING]  org.scalanlp:breeze-macros_2.10:0.11.2 requires scala version: 2.10.4
[WARNING]  org.spire-math:spire_2.10:0.7.4 requires scala version: 2.10.2

这是我在pom.xml中的依赖项:

<build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
    </dependency>
    <dependency>
        <groupId>org.scala-lang</groupId>
        <artifactId>scala-library</artifactId>
        <version>2.10.4</version>
    </dependency>
    <dependency>
        <groupId>org.scalatest</groupId>
        <artifactId>scalatest_2.10</artifactId>
        <version>2.2.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.thoughtworks.xstream</groupId>
        <artifactId>xstream</artifactId>
        <version>1.4.4</version>
    </dependency>
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.2.4</version>
    </dependency>
    <dependency>
        <groupId>nz.ac.waikato.cms.weka</groupId>
        <artifactId>weka-stable</artifactId>
        <version>3.6.6</version>
        <exclusions>
            <exclusion>
                <artifactId>java-cup</artifactId>
                <groupId>
  net.sf.squirrel-sql.thirdparty-non-maven
 </groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-client</artifactId>
        <version>2.4.0</version>
        <exclusions>
            <exclusion>
                <artifactId>zookeeper</artifactId>
                <groupId>org.apache.zookeeper</groupId>
            </exclusion>
            <exclusion>
                <artifactId>guava</artifactId>
                <groupId>com.google.guava</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-servlet</artifactId>
        <version>8.1.14.v20131031</version>
    </dependency>
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>14.0.1</version>
    </dependency>

    <dependency>
        <groupId>net.sourceforge.argparse4j</groupId>
        <artifactId>argparse4j</artifactId>
        <version>0.4.3</version>
    </dependency>
    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk</artifactId>
        <version>1.9.1</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
    </dependency>
    <dependency>
        <groupId>com.github.scopt</groupId>
        <artifactId>scopt_2.10</artifactId>
        <version>3.3.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-mllib_2.10</artifactId>
        <version>1.3.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.lucene</groupId>
        <artifactId>lucene-spellchecker</artifactId>
        <version>3.6.2</version>
    </dependency>
</dependencies>

有没有办法可以找出使用哪种依赖:

  org.spire-math:spire_2.10:0.7.4 requires scala version: 2.10.2

所以我可以做出相应的改变吗?非常感谢!

2 个答案:

答案 0 :(得分:2)

执行命令

mvn dependency:tree

找出哪个依赖关系正在拉下尖顶。

答案 1 :(得分:2)

运行以下命令并将输出存储在文件(ouput.txt)中并对其进行分析。

mvn dependency:tree > output.txt

您可以找到内部带来额外依赖关系的包。只需在mvn依赖关系树文件中搜索包名称即可。