Maven快照部署策略值得怀疑

时间:2015-03-31 06:47:15

标签: maven

截至目前,我们常常检查整个项目,并一直编译所有项目。

所以现在我们只想检查我们想要修改的内容,为此我们实现了版本以便轻松跟踪修改发生的位置。

Let say we have project A
    Project B
    Project C

如果我想修改项目C,我想只签出项目C,但项目C依赖于A和B.

A和B必须从nexus下载。 对于A和B上的每个修改,将工件部署到nexus中,C将从nexus获得这些更改。

正如我对这个概念的喵喵,任何人都可以让我知道如何使这个正常运作.. 问题

因为我观察到所有快照都是基于时间戳的,哪些依赖项将下载最新或最旧, 如果我想将旧快照作为依赖项,我该怎么办? 任何最佳实践建议?

添加错误代码: -

使用-T 1.5C时出现此错误:

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven32Main.launch(Maven32Main.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
at hudson.remoting.UserRequest.perform(UserRequest.java:121)
at hudson.remoting.UserRequest.perform(UserRequest.java:49)
at hudson.remoting.Request$2.run(Request.java:324)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:314)
at java.util.concurrent.FutureTask.run(FutureTask.java:149)
at    java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:906)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:929)
at java.lang.Thread.run(Thread.java:738)
 Caused by: org.apache.maven.cli.MavenExecutionRequestsBuilderException: Must provide a thread count for -T
at org.apache.maven.cli.DefaultMavenExecutionRequestBuilder.getMavenExecutionRequest(DefaultMavenExecutionRequestBuilder.java:192)
at org.jvnet.hudson.maven3.launcher.Maven32Launcher.getMavenExecutionRequest(Maven32Launcher.java:153)
at org.jvnet.hudson.maven3.launcher.Maven32Launcher.main(Maven32Launcher.java:130)
... 22 more
 Caused by: java.lang.IllegalArgumentException: Must provide a thread count for -T
at org.apache.maven.cli.DefaultMavenExecutionRequestBuilder.populateRequest(DefaultMavenExecutionRequestBuilder.java:982)
at org.apache.maven.cli.DefaultMavenExecutionRequestBuilder.getMavenExecutionRequest(DefaultMavenExecutionRequestBuilder.java:172)
... 24 more
  ERROR: Failed to parse POMs
  java.io.IOException: Remote call on Channel to Maven [/opt/ibm/java-x86_64-60/bin/java, -cp, /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven32-agent-1.6.jar:/opt/apache/apache-maven-3.2.5/boot/plexus-classworlds-2.5.2.jar:/opt/apache/apache-maven-3.2.5/conf/logging, jenkins.maven3.agent.Maven32Main, /opt/apache/apache-maven-3.2.5, /var/cache/jenkins/war/WEB-INF/lib/remoting-2.49.jar, /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven32-interceptor-1.6.jar, /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.6.jar, 45090] failed
at hudson.remoting.Channel.call(Channel.java:756)
at hudson.maven.ProcessCache$MavenProcess.call(ProcessCache.java:161)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:849)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:536)
at hudson.model.Run.execute(Run.java:1718)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
 Caused by: java.lang.ClassNotFoundException: org.apache.maven.cli.MavenExecutionRequestsBuilderException
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:430)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:624)
at hudson.remoting.MultiClassLoaderSerializer$Input.resolveClass(MultiClassLoaderSerializer.java:116)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1611)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1516)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1770)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1349)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1989)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1914)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1797)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1349)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1989)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1914)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1797)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1349)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1989)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1914)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1797)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1349)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1989)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1914)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1797)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1349)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
at hudson.remoting.UserRequest.deserialize(UserRequest.java:185)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:218)
at hudson.remoting.Channel.call(Channel.java:752)
... 7 more

1 个答案:

答案 0 :(得分:0)

如果您想使用较旧的SNAPSHOT状态,可以通过在您的pom中定义适当的版本来实现:

versions-maven-plugin可以在lock-snapshotsunlock-snapshots的情况下提供帮助。

除此之外,您应该知道可以在update policy文件中更改的settings.xml。或者您可以通过以下方式手动强制更新:

mvn -U ...