我正在使用maven-3.2.3,maven-depedency-plugin-3.0.2
和maven-assembly-plugin-3.0.0
所有这些都是线程安全的,但是在使用4个线程运行maven build时
(mvn clean install -T 4
),
我正在间歇地打击
org.apache.maven.artifact.versioning.OverConstrainedVersionException
如果我尝试用单线程(mvn clean install
)
这是错误的堆栈跟踪
23:31:55 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:3.0.0:single (my-service-dependency-assembly) on project my-service: Failed to create assembly: Unable to resolve dependencies for assembly 'service-third-party-dependencies'
23:31:55 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
23:31:55 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
23:31:55 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
23:31:55 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
23:31:55 at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:188)
23:31:55 at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:184)
23:31:55 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
23:31:55 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
23:31:55 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
23:31:55 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
23:31:55 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
23:31:55 at java.lang.Thread.run(Thread.java:745)
23:31:55 Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to create assembly: Unable to resolve dependencies for assembly 'service-third-party-dependencies'
23:31:55 at org.apache.maven.plugins.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:530)
23:31:55 at org.apache.maven.plugins.assembly.mojos.SingleAssemblyMojo.execute(SingleAssemblyMojo.java:58)
23:31:55 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
23:31:55 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
23:31:55 ... 11 more
23:31:55 Caused by: org.apache.maven.plugins.assembly.archive.ArchiveCreationException: Unable to resolve dependencies for assembly 'service-third-party-dependencies'
23:31:55 at org.apache.maven.plugins.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:204)
23:31:55 at org.apache.maven.plugins.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:476)
23:31:55 ... 14 more
23:31:55 Caused by: org.apache.maven.plugins.assembly.artifact.DependencyResolutionException: Failed to resolve dependencies for assembly:
23:31:55 at org.apache.maven.plugins.assembly.artifact.DefaultDependencyResolver.resolveTransitively(DefaultDependencyResolver.java:235)
23:31:55 at org.apache.maven.plugins.assembly.artifact.DefaultDependencyResolver.resolve(DefaultDependencyResolver.java:118)
23:31:55 at org.apache.maven.plugins.assembly.artifact.DefaultDependencyResolver.resolveDependencySets(DefaultDependencyResolver.java:154)
23:31:55 at org.apache.maven.plugins.assembly.archive.phase.DependencySetAssemblyPhase.execute(DependencySetAssemblyPhase.java:95)
23:31:55 at org.apache.maven.plugins.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:181)
23:31:55 ... 15 more
23:31:55 Caused by: org.apache.maven.artifact.versioning.OverConstrainedVersionException: No versions are present in the repository for the artifact with a range [13.0.0,14.0.999)
com.mygroup.group:my-artifact:jar:null
答案 0 :(得分:0)
多次运行构建后,发现maven-assembly-plugin
的依赖项解析存在问题。创建程序集时,程序集插件不接受pom.xml
中定义的排除项。
为解决此问题,我将依赖项收集部分移至maven-dependency-plugin
并仅使用程序集插件来创建所有工件的tar包。
那解决了这个问题。