【发布时间】:2015-07-11 01:05:35
【问题描述】:
我在做什么?
我创建了一个maven 项目,我在其中捆绑了一些外部 jar
project/pom.xml
/bin
/safebrowsing2_2.11-0.2.5.jar
/scala-http-client_2.11-1.0.jar
safebrowsing2_2.11-0.2.5.jar 和 scala-http-client_2.11-1.0.jar 库是捆绑在一起的,因为它们在 Nexus 中不可用,并且是遗留用途所需的自定义 jar。
pom.xml 使用以下plugins 将它们捆绑在一个罐子中
<plugins>
<plugin>
<groupId>com.googlecode.addjars-maven-plugin</groupId>
<artifactId>addjars-maven-plugin</artifactId>
<version>1.0.5</version>
<executions>
<execution>
<goals>
<goal>add-jars</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${basedir}/bin</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
当此构建在 Jenkins 上运行时,它会失败并出现以下警告
[WARNING] The POM for com.shn:project-safebrowsing2_2.11-0.2.5.jar:jar:1.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.shn:project-scala-http-client_2.11-1.0.jar:jar:1.0-SNAPSHOT is missing, no dependency information available
错误是
[ERROR] Failed to execute goal on project project-installer: Could not resolve dependencies for project com.project-installer:war:0.19.0-SNAPSHOT: The following artifacts could not be resolved: com.shn:project-external-dependencies-safebrowsing2_2.11-0.2.5.jar:jar:1.0-SNAPSHOT, com.shn:project-scala-http-client_2.11-1.0.jar:jar:1.0-SNAPSHOT: Could not find artifact com.shn:project-safebrowsing2_2.11-0.2.5.jar:jar:1.0-SNAPSHOT in company (http://172.62.11.24:8080/nexus/content/groups/public) -> [Help 1]
16:17:03 [ERROR]
16:17:03 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
16:17:03 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
16:17:03 [ERROR]
16:17:03 [ERROR] For more information about the errors and possible solutions, please read the following articles:
16:17:03 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
问题
是的,我知道他们没有pom.xml,但是如何让构建通过并生成工件?
【问题讨论】:
-
有些人可能会发现警告和错误之间的相关性有点有趣,其他人只注意到警告^^ 为了执行目标,您必须正确安装 2 个错误的工件。
-
将它们安装到您的关系中,就完成了。或者开始使用存储库管理器。