我有一个多模块maven项目,我无法编译。我有一个Nexus仓库位于我的本地网络上,它正在工作(IntelliJ Idea能够解决仅驻留在该仓库中的依赖项),并且我正在通过Jetbrains TeamCity进行构建。我非常确定TeamCity正在工作,因为我已经设置的其他几个构建配置仍然有效(使用相同的settings.xml)。对于可能导致此问题的原因,我有点不知所措。这里是我的POM文件:Maven多模块项目,不解决依赖
父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>
产品无线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>
产品分页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>
而且我得到的错误是:
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]无法执行项目product-wireless-plugin的目标:无法解析依赖关系项目com.company.product.plugins:product-wireless-plugin:jar:0.1.2:无法收集[com.company.prod uct:product-common:jar:0.9.1(compile)]
我在试图调试时遇到了相当的损失...有没有人有任何建议?
1)对于这种“无法解析的依赖”的错误,几乎总是在构建日志中更早的更详细的错误消息和/或堆栈跟踪。 2)用'-X'标志重新运行构建。 – noahlz
@noahlz如果你可以发表你的评论作为答案,我会接受它。我能够使用该调试方法找到问题。 –