我在做什么?
我创建了一个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
将它们捆绑在一个jar
<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
,但我如何让构建通过并生成工件?
答案 0 :(得分:4)
使用install-file
的Maven's Install Plugin目标:
...将外部创建的工件及其POM安装到本地存储库中。
使用deploy-file
的Maven's Deploy Plugin目标:
将工件安装在远程存储库中。
...而不是将工件放在项目的目录中。