Working in eclipse / maven / sonatype war works on the command line, but not in eclipse

My (simple) military project builds fine using mvn: package on the command line, but cannot build in eclipse using maven via the sonatip plugin. The error I am getting is:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1-alpha-1:war (default-war) on project shoploops_webapp: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.1-alpha-1:war failed: dependenciesInfo : dependenciesInfo ---- Debugging information ---- message : dependenciesInfo : dependenciesInfo cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException cause-message : dependenciesInfo : dependenciesInfo class : org.apache.maven.plugin.war.util.WebappStructure required-type : org.apache.maven.plugin.war.util.WebappStructure path : /webapp-structure/dependenciesInfo line number : 14 

I really have two questions 1) How can I fix this error? 2) Why mvn: the package works fine on the command line, but not through the plugin? What is the difference between them in how they work, for example, such errors can occur?

Many thanks!

Edit : stack trace from startup in debug mode:

 Caused by: com.thoughtworks.xstream.converters.ConversionException: dependenciesInfo : dependenciesInfo ---- Debugging information ---- message : dependenciesInfo : dependenciesInfo cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException cause-message : dependenciesInfo : dependenciesInfo class : org.apache.maven.plugin.war.util.WebappStructure required-type : org.apache.maven.plugin.war.util.WebappStructure path : /webapp-structure/dependenciesInfo line number : 14 ------------------------------- at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:63) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46) at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:117) at com.thoughtworks.xstream.core.ReferenceByXPathMarshallingStrategy.unmarshal(ReferenceByXPathMarshallingStrategy.java:29) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:846) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:833) at com.thoughtworks.xstream.XStream.fromXML(XStream.java:781) at org.apache.maven.plugin.war.util.WebappStructureSerializer.fromXml(WebappStructureSerializer.java:48) at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:346) at org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:317) at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:166) at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:130) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105) ... 15 more Caused by: com.thoughtworks.xstream.mapper.CannotResolveClassException: dependenciesInfo : dependenciesInfo at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:49) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.ClassAliasingMapper.realClass(ClassAliasingMapper.java:76) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:60) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.ArrayMapper.realClass(ArrayMapper.java:76) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:26) at com.thoughtworks.xstream.mapper.CachingMapper.realClass(CachingMapper.java:34) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.determineType(AbstractReflectionConverter.java:296) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:178) at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:125) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56) ... 28 more 
+4
source share
3 answers

Why does mvn:package work fine on the command line, but not through the plugin? What is the difference between them in how they work, for example, such errors can occur?

The short option is that m2eclipse is not using the same version as the command line if you did not tell it to do this (and that will be my recommendation). If you're interested, m2eclipse uses the built-in Maven 3 (Maven Embedder 3.0.0.200912160759).

How can I fix this error?

In fact, the problem is logged at http://jira.codehaus.org/browse/MWAR-187 , which provides several workarounds.

  • downgrade maven-war plugin to 2.1-alpha-1
  • deactivate cache by changing maven-war-plugin configuration

     <configuration> <useCache>false</useCache> </configuration> 

And I think that setting M2Eclipse to use Maven Embedder (but the version you use in the CLI) would also solve the problem, and this is my suggestion. You will find this option in Window> Preferences> Maven .

+4
source

I have the same problem, but I am doing mvn install . Worked fine on the command line, but failed with Eclipse.

In fact, it happened that my webapp-cache.xml was webapp-cache.xml corrupted. I solved the problem with running mvn clean install .

+2
source

You need to go to preferences->maven->installation and select an external installation. I am using the springsource toolkit. But the maven configuration path should be the same in another variety of eclipse.

+1
source

Source: https://habr.com/ru/post/1309576/


All Articles