我们使用 Jenkins/Maven 进行构建管理和持续集成。管理第三方库应该由我们设置的 Nexus 服务器来处理。
- 有问题的第 3 方库是 org.eclipse.bpmn2 0.7.0
- 据我们所知,这个库不托管在远程 Maven 存储库中
- 我们已将 3rd 方库上传到托管的 Nexus 3rd 方存储库
- 我们有一些指向网络的代理 Nexus 存储库(有效)
现在到(也许)问题部分:
- 我们的项目由 Eclipse 插件组成
- 因此,我们需要访问 eclipse p2 存储库
- Manifest.MF 中描述了对第 3 方库的依赖项
- Nexus 开源不支持 p2 存储库
- 因此,我们必须将 Eclipse p2 存储库添加到项目 POM
首先,(可能)来自 Jenkins 使用的 Maven 的 settings.xml 中的相关设置:
<localRepository>/var/lib/jenkins/local_repo</localRepository>
我们有一个本地 Maven 存储库。
也许很重要:本地 Maven 存储库和 Nexus 如何协同工作?本地存储库是多余的吗?它会与 Nexus 库冲突吗?还是 Maven 仅从 Nexus 加载依赖项并存储在本地存储库中?我们应该在安装 Nexus 后清空它吗?
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://localhost:8082/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built central repo to direct
all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
正如您可能看到的,我们现在使用默认的 nexus 配置。现在到相关项目POM内容:
<repositories>
<!--
<repository>
<id>UML2</id>
<layout>p2</layout>
<url>http://download.eclipse.org/modeling/mdt/updates/releases/</url>
</repository>
-->
<repository>
<id>indigo</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/indigo</url>
</repository>
</repositories>
我们尝试将 p2 存储库合并到 Nexus 中,但随后发现开源版本无法处理 p2 存储库。所以我们需要把它们放在项目的 POM 中,作为 Nexus 之外的存储库。MDT 存储库被注释掉,因为它似乎没有它也能工作。
对 org.eclipse.bpmn2 的依赖位于使用它的相应插件的 manifest.MF 中:
Require-Bundle:
org.eclipse.bpmn2;bundle-version="0.7.0";visibility:=reexport
该库已上传到 Nexus(使用 GAV 参数):
- GroupID:org.eclipse
- ArtifactID:org.eclipse.bpmn2
- 版本:0.7.0.201111021300
- 包装:罐子
可能很重要:分类器留空。这里应该输入什么?
使用 -e -X 启动 Jenkins 作业和 Maven 时,输出如下:
[DEBUG] P2resolver.addMavenProject de.some.tool:pom:2.0
[INFO] Adding repository (cached) http://download.eclipse.org/releases/indigo
[DEBUG] Added p2 repository indigo (http://download.eclipse.org/releases/indigo)
[INFO] Cannot complete the request. Generating details.
[INFO] Cannot complete the request. Generating details.
[INFO] {org.osgi.framework.executionenvironment=OSGi/Minimum-1.0,OSGi/Minimum-1.1, osgi.ws=gtk, osgi.arch=x86, osgi.os=linux, org.eclipse.update.install.features=true, org.osgi.framework.system.packages=}
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: de.modeltype.bpmn2 1.0.0.qualifier
[ERROR] Missing requirement: de.modeltype.bpmn2 1.0.0.qualifier requires 'bundle org.eclipse.bpmn2 0.7.0' but it could not be found
[ERROR]
mavenExecutionResult exceptions not empty
message : Internal error: java.lang.RuntimeException: "No solution found because the problem is unsatisfiable.": ["Unable to satisfy dependency from de.modeltype.bpmn2 1.0.0.qualifier to bundle org.eclipse.bpmn2 0.7.0.", "No solution found because the problem is unsatisfiable."]
cause : "No solution found because the problem is unsatisfiable.": ["Unable to satisfy dependency from de.modeltype.bpmn2 1.0.0.qualifier to bundle org.eclipse.bpmn2 0.7.0.", "No solution found because the problem is unsatisfiable."]
Stack trace :
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: "No solution found because the problem is unsatisfiable.": ["Unable to satisfy dependency from de.modeltype.bpmn2 1.0.0.qualifier to bundle org.eclipse.bpmn2 0.7.0.", "No solution found because the problem is unsatisfiable."]
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:168)
at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:104)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:70)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:287)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.RuntimeException: "No solution found because the problem is unsatisfiable.": ["Unable to satisfy dependency from de.modeltype.bpmn2 1.0.0.qualifier to bundle org.eclipse.bpmn2 0.7.0.", "No solution found because the problem is unsatisfiable."]
at org.eclipse.tycho.p2.impl.resolver.ProjectorResolutionStrategy.resolve(ProjectorResolutionStrategy.java:106)
at org.eclipse.tycho.p2.impl.resolver.P2ResolverImpl.resolveProject(P2ResolverImpl.java:102)
at org.eclipse.tycho.p2.impl.resolver.P2ResolverImpl.resolveProject(P2ResolverImpl.java:69)
at org.eclipse.tycho.p2.resolver.P2TargetPlatformResolver.doResolvePlatform(P2TargetPlatformResolver.java:342)
at org.eclipse.tycho.p2.resolver.P2TargetPlatformResolver.resolvePlatform(P2TargetPlatformResolver.java:162)
at org.eclipse.tycho.core.resolver.DefaultTychoDependencyResolver.resolveProject(DefaultTychoDependencyResolver.java:85)
at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:91)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:273)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
... 19 more
channel stopped
Finished: FAILURE
我们做错了什么?