2015-09-03 82 views
1

我們在Jenkins(Java 6)中使用Maven 3.2.3。我們正在構建一個多模塊項目。但是,有些項目在運行Maven-War-plugin目標時失敗。這裏是配置...Maven war插件失敗,出現錯誤「No such field org.apache.maven.model.Dependency.managementKey」

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-war-plugin</artifactId> 
    <version>2.6</version> 
    <configuration> 
     <useCache>true</useCache> 
     <cacheFile>/tmp/${project.artifactId}/war/work</cacheFile> 
    </configuration> 
</plugin> 

以下是錯誤消息。我們使用的命令是「mvn clean install」

[INFO] Total time: 02:59 min 
[INFO] Finished at: 2015-09-03T18:08:08+00:00 
[INFO] Final Memory: 53M/695M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.6:war (default-war) on project orgsclient: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.6:war failed: No such field org.apache.maven.model.Dependency.managementKey 
[ERROR] ---- Debugging information ---- 
[ERROR] field    : managementKey 
[ERROR] class    : org.apache.maven.model.Dependency 
[ERROR] required-type  : org.apache.maven.model.Dependency 
[ERROR] converter-type  : com.thoughtworks.xstream.converters.reflection.ReflectionConverter 
[ERROR] path    : /webapp-structure/dependenciesInfo/org.apache.maven.plugin.war.util.DependencyInfo/dependency/managementKey 
[ERROR] class[1]   : org.apache.maven.plugin.war.util.DependencyInfo 
[ERROR] class[2]   : java.util.ArrayList 
[ERROR] converter-type[1] : com.thoughtworks.xstream.converters.collections.CollectionConverter 
[ERROR] class[3]   : org.apache.maven.plugin.war.util.WebappStructure 
[ERROR] version    : null 
[ERROR] ------------------------------- 
[ERROR] -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.6:war (default-war) on project orgsclient: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.6:war failed: No such field org.apache.maven.model.Dependency.managementKey 
---- Debugging information ---- 
field    : managementKey 
class    : org.apache.maven.model.Dependency 
required-type  : org.apache.maven.model.Dependency 
converter-type  : com.thoughtworks.xstream.converters.reflection.ReflectionConverter 
path    : /webapp-structure/dependenciesInfo/org.apache.maven.plugin.war.util.DependencyInfo/dependency/managementKey 
class[1]   : org.apache.maven.plugin.war.util.DependencyInfo 
class[2]   : java.util.ArrayList 
converter-type[1] : com.thoughtworks.xstream.converters.collections.CollectionConverter 
class[3]   : org.apache.maven.plugin.war.util.WebappStructure 
version    : null 
------------------------------- 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154) 
    at org.jvnet.hudson.maven3.launcher.Maven32Launcher.main(Maven32Launcher.java:132) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:606) 
    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:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:606) 
    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:325) 
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:745) 
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.6:war failed: No such field org.apache.maven.model.Dependency.managementKey 
---- Debugging information ---- 
field    : managementKey 
class    : org.apache.maven.model.Dependency 
required-type  : org.apache.maven.model.Dependency 
converter-type  : com.thoughtworks.xstream.converters.reflection.ReflectionConverter 
path    : /webapp-structure/dependenciesInfo/org.apache.maven.plugin.war.util.DependencyInfo/dependency/managementKey 
class[1]   : org.apache.maven.plugin.war.util.DependencyInfo 
class[2]   : java.util.ArrayList 
converter-type[1] : com.thoughtworks.xstream.converters.collections.CollectionConverter 
class[3]   : org.apache.maven.plugin.war.util.WebappStructure 
version    : null 
------------------------------- 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:143) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) 
    ... 30 more 
Caused by: com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$UnknownFieldException: No such field org.apache.maven.model.Dependency.managementKey 
---- Debugging information ---- 
field    : managementKey 
class    : org.apache.maven.model.Dependency 
required-type  : org.apache.maven.model.Dependency 
converter-type  : com.thoughtworks.xstream.converters.reflection.ReflectionConverter 
path    : /webapp-structure/dependenciesInfo/org.apache.maven.plugin.war.util.DependencyInfo/dependency/managementKey 
class[1]   : org.apache.maven.plugin.war.util.DependencyInfo 
class[2]   : java.util.ArrayList 
converter-type[1] : com.thoughtworks.xstream.converters.collections.CollectionConverter 
class[3]   : org.apache.maven.plugin.war.util.WebappStructure 
version    : null 
------------------------------- 
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.determineType(AbstractReflectionConverter.java:453) 
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:294) 
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:234) 
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72) 
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65) 
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66) 
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:355) 
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:306) 
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:234) 
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72) 
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65) 
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66) 
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50) 
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71) 
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.addCurrentElementToCollection(CollectionConverter.java:79) 
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.populateCollection(CollectionConverter.java:72) 
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.populateCollection(CollectionConverter.java:66) 
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.unmarshal(CollectionConverter.java:61) 
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72) 
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65) 
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66) 
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:355) 
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:306) 
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:234) 
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72) 
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65) 
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66) 
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50) 
    at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134) 
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32) 
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1058) 
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1042) 
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:913) 
    at org.apache.maven.plugin.war.util.WebappStructureSerializer.fromXml(WebappStructureSerializer.java:78) 
    at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:448) 
    at org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:420) 
    at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:212) 
    at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:175) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132) 
    ... 31 more 

這個錯誤是什麼意思?我完全喪失了。

+1

您是否嘗試過不使用'?'由於它是[_「實驗性功能,因此在默認情況下處於禁用狀態。」](https://maven.apache.org/plugins/maven-war-plugin/war- mojo.html)。 –

+0

是的,沒有useCache,那麼它的工作。 WTF Maven ?? – Dave

+0

您對實驗性功能有什麼期待?甚至在文檔中也會這樣聲明(IT中並非總是如此)。免費提供一款偉大的軟件,由志願者設計,開發和支持。 –

回答

0

如果沒有指定useCache,也有同樣的問題。通過addidng <useCache>false</useCache>直接解決了<configuration>

相關問題