maven解析错误的依赖版本

时间:2017-09-28 12:04:43

标签: java maven playframework

我有一个使用maven进行依赖关系管理的游戏项目。假设我有项目'MyProject',它有一个父pom,它将依赖版本定义为属性

<properties> <abc.version>RS_1.0.1-SNAPSHOT</abc.version> </properties>

其中'abc'是MyProject使用的另一个java模块。

当我从MyProject根目录运行mvn clean compile -DskipTests=true时,构建失败,说它无法解析abc的依赖关系。这是在〜/ .m2 / repository中已经存在abc的时候。它实际上使用版本'working @ my_machine_name'而不是'RS_1.0.1-SNAPSHOT'搜索依赖项,因此无法找到它。

我已经尝试清理.m2和.ivy2并重建项目但它不起作用。当我执行mvn dependency:tree时,它会显示abc的正确版本,但在运行时需要'working @ machine_name'。

有没有人遇到类似问题或者知道原因?任何帮助将不胜感激。

这是我的父pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>placeholder</groupId>
    <artifactId>placeholder</artifactId>
    <version>1.0.7</version>
</parent>
<groupId>com.example</groupId>
<artifactId>example</artifactId>
<version>RS_1.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Example</name>
<modules>
    <module>service</module>
</modules>
<scm>
    <connection>placeholder</connection>
    <developerConnection>placeholder</developerConnection>
</scm>
<properties>
    <gitolderthan>2016-04-15 00:00:00.0 AM</gitolderthan>
    <jacocoExecutionDataFile>${project.basedir}/target/jacoco.exec</jacocoExecutionDataFile>
    <jacocoVersion>0.7.2.201409121644</jacocoVersion>
    <play2.plugin.version>1.0.0-beta3</play2.plugin.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <sbt-compiler.plugin.version>1.0.0-beta5</sbt-compiler.plugin.version>
    <play2-scala.version>2.11</play2-scala.version>
    <module_which_is_failing.version>RS_1.0.1-SNAPSHOT</module_which_is_failing.version>
    <swagger.version>1.3.12</swagger.version>
</properties>
<dependencyManagement>
    <dependencies>
        <dependency>
             <groupId>com.typesafe</groupId>
             <artifactId>config</artifactId>
             <version>1.3.0</version>
             <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.wordnik</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>${swagger.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
            <version>4.3</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.16</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>janino</groupId>
            <artifactId>janino</artifactId>
            <version>2.5.10</version>
        </dependency>
        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path</artifactId>
            <version>0.9.0</version>
        </dependency>
        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path-assert</artifactId>
            <version>0.9.0</version>
        </dependency>
        <dependency>
            <groupId>com.codahale.metrics</groupId>
            <artifactId>metrics-core</artifactId>
            <version>3.0.0-RC1</version>
        </dependency>
        <dependency>
            <groupId>com.codahale.metrics</groupId>
            <artifactId>metrics-graphite</artifactId>
            <version>3.0.0-RC1</version>
        </dependency>
        <dependency>
            <groupId>com.codahale.metrics</groupId>
            <artifactId>metrics-ganglia</artifactId>
            <version>3.0.0-RC1</version>
        </dependency>
        <dependency>
            <groupId>com.codahale.metrics</groupId>
            <artifactId>metrics-logback</artifactId>
            <version>3.0.0-RC1</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>1.0.13</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.6</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.0.13</version>
        </dependency>
        <dependency>
            <groupId>com.codahale.metrics</groupId>
            <artifactId>metrics-annotation</artifactId>
            <version>3.0.0-RC1</version>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.10.19</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>1.10.19</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <version>1.6.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito</artifactId>
            <version>1.6.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.wink</groupId>
            <artifactId>wink-component-test-support</artifactId>
            <version>1.3.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity</artifactId>
            <version>1.7</version>
        </dependency>
        <dependency>
            <groupId>org.mvel</groupId>
            <artifactId>mvel2</artifactId>
            <version>2.2.5.Final</version>
        </dependency>
        <dependency>
            <groupId>module_which_is_failing</groupId>
            <artifactId>module_which_is_failing_submodule1</artifactId>
            <version>${ssi-scheduler-contract.version}</version>
        </dependency>
        <dependency>
            <groupId>com.servicesource.scheduler.contract</groupId>
            <artifactId>module_which_is_failing_submodule2</artifactId>
            <version>${ssi-scheduler-contract.version}</version>
        </dependency>
        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
            <version>2.2.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-csv</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
            <version>2.16.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-mongodb</artifactId>
            <version>2.16.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-aws</artifactId>
            <version>2.16.3</version>
    <exclusions>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-databind</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-annotations</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-hazelcast</artifactId>
            <version>2.16.3</version>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>amazon-sqs-java-messaging-lib</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-sqs</artifactId>
            <version>1.11.3</version>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-s3</artifactId>
            <version>1.11.3</version>
        </dependency>
        <dependency>
            <groupId>javax.jms</groupId>
            <artifactId>jms-api</artifactId>
            <version>1.1-rev-1</version>
        </dependency>
    </dependencies>
</dependencyManagement>
<repositories>
    <repository>
        <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
        </releases>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
        </snapshots>
        <id>placeholder</id>
        <name>placeholder</name>
        <url>placeholder</url>
        <layout>default</layout>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
        </releases>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
        </snapshots>
        <id>placeholder</id>
        <name>placeholder</name>
        <url>placeholder</url>
        <layout>default</layout>
    </pluginRepository>
</pluginRepositories>
<build>
    <plugins>
        <plugin>
            <groupId>placeholder</groupId>
            <artifactId>play2-maven-plugin</artifactId>
            <version>${root.version}</version>
            <extensions>true</extensions>
        </plugin>
    </plugins>
</build>

P.S。我用“占位符”替换了重要的条目

0 个答案:

没有答案