Maven多模块项目,不解决依赖关系

Bre*_*gan 4 teamcity maven

我有一个多模块maven项目,我无法编译.我在我的本地网络上有一个Nexus存储库,它正在工作(IntelliJ Idea能够解析仅存在于该存储库中的依赖关系),我正在通过Jetbrains TeamCity构建.我相当确定TeamCity正在工作,因为我设置的其他几个构建配置仍然有效(使用相同的settings.xml).对于可能导致问题的原因,我有点失落.这是我的pom文件:

父母pom:

<?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>

    <groupId>com.company.product.plugins</groupId>
    <artifactId>plugin-parent</artifactId>
    <version>1.2-SNAPSHOT</version>
    <packaging>pom</packaging>

    <modules>
        <module>product-wireless-plugin</module>
        <module>product-paging-plugin</module>
    </modules>

    <distributionManagement>
        <repository>
            <id>releases</id>
            <url>http://192.168.2.192:8081/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <url>http://192.168.2.192:8081/nexus/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <pluginRepositories>
        <pluginRepository>
            <id>autoincrement-versions-maven-plugin</id>
            <name>autoincrement-versions-maven-plugin</name>
            <url>http://autoincrement-versions-maven-plugin.googlecode.com/svn/repo</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>autoincrement-versions-maven-plugin</artifactId>
                <version>2.0-SNAPSHOT</version>
                <executions>
                    <execution>
                        <id>update-pom-versions</id>
                        <goals>
                            <goal>increment</goal>
                            <goal>commit</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <autoIncrementVersion>true</autoIncrementVersion>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
Run Code Online (Sandbox Code Playgroud)

产品 - 无线pom:

<?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">
    <parent>
        <artifactId>plugin-parent</artifactId>
        <groupId>com.company.product.plugins</groupId>
        <version>1.2-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.company.product.plugins</groupId>
    <artifactId>product-wireless-plugin</artifactId>
    <version>0.1.2</version>

    <distributionManagement>
        <repository>
            <id>releases</id>
            <url>http://192.168.2.192:8081/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <url>http://192.168.2.192:8081/nexus/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <dependencies>
        <dependency>
            <groupId>com.company.product</groupId>
            <artifactId>product-common</artifactId>
            <version>0.9.1</version>
        </dependency>
    </dependencies>

</project>
Run Code Online (Sandbox Code Playgroud)

产品分页pom:

<?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">
    <parent>
        <artifactId>plugin-parent</artifactId>
        <groupId>com.company.product.plugins</groupId>
        <version>1.2-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.company.product.plugins</groupId>
    <artifactId>product-paging-plugin</artifactId>
    <version>0.1.2</version>

    <distributionManagement>
        <repository>
            <id>releases</id>
            <url>http://192.168.2.192:8081/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <url>http://192.168.2.192:8081/nexus/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <dependencies>
        <dependency>
            <groupId>com.company.product</groupId>
            <artifactId>product-common</artifactId>
            <version>0.9.1</version>
        </dependency>
    </dependencies>

</project>
Run Code Online (Sandbox Code Playgroud)

而我得到的错误是:

com.company.product.plugins:product-wireless-plugin [13:54:16] [com.company.product.plugins:product-wireless-plugin]从'C:/ TeamCity/buildAgent/work/40ac813105cf8bd7 /导入数据product-wireless-plugin/target/surefire-reports/TEST - *.xml'with' surefire'processor [13:54:16] [com.company.product.plugins:product-wireless-plugin] Surefire报告观察者[13] :54:16] [com.company.product.plugins:product-wireless-plugin]正在下载:repolocation/nexus/content/groups/public/com/company/product/product-parent/0.9.0/product-parent- 0.9.0.pom [13:54:16] [com.company.product.plugins:product-wireless-plugin]无法在项目产品无线插件上执行目标:无法解析项目com.company.product的依赖项.plugins:product-wireless-plugin:jar:0.1.2:无法收集[com.company.product:的依赖项:product-common:jar:0.9.1(编译)]

在尝试调试时我感到非常茫然...有没有人有任何建议?

noa*_*hlz 7

有几种方法/工具可以解决此类问题.

  1. 对于"无法解决依赖关系"错误,在构建日志中几乎总是有更详细的错误消息和/或堆栈跟踪.Maven日志实际上非常冗长,以至于必须从构建失败中搜索几个屏幕的"根"错误消息.

  2. 使用-X标志重新运行构建.这是Maven命令行开关的文档

  3. 另一种选择是用于mvn dependency:tree检查传递依赖的完整图.mvn help:effective-pom是另一个有用的工具,在考虑settings.xml,任何活动的配置文件等后打印出pom.xml.同样mvn help:active-profiles