我在Amazon Linux上使用Maven 3.3.3,并使用Maven WAR插件,我已经在我的父pom中设置了像这样的本地目标
<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/webapp-cache.xml</cacheFile>
<recompressZippedFiles>false</recompressZippedFiles>
</configuration>
<executions>
<execution>
<id>default-war</id>
<phase>verify</phase>
</execution>
<execution>
<id>war-inplace</id>
<phase>package</phase>
<goals>
<goal>inplace</goal>
</goals>
</execution>
</executions>
</plugin>
然而,当我在我的子项目上运行"mvn clean install -DskipTests -X"目标时,我得到了错误,"XML文档结构必须在同一实体内开始和结束"。我不知道WAR插件在抱怨什么。下面是调试堆栈跟踪。它指的是哪里,我该如何修复它?
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-war-plugin:3.0.0:inplace' with basic configurator -->
[DEBUG] (s) archiveClasses = false
[DEBUG] (s) cacheFile = /tmp/myprojecct/war/work/webapp-cache.xml
[DEBUG] (s) classesDirectory = /home/jboss/.jenkins/jobs/subco/workspace/myprojecct/target/classes
[DEBUG] (f) escapedBackslashesInFilePath = false
[DEBUG] (f) filteringDeploymentDescriptors = false
[DEBUG] (f) includeEmptyDirectories = false
[DEBUG] (s) project = MavenProject: org.collegeboard.subco:myprojecct:94.0.0-SNAPSHOT @ /home/jboss/.jenkins/jobs/subco/workspace/myprojecct/pom.xml
[DEBUG] (f) recompressZippedFiles = false
[DEBUG] (f) resourceEncoding = UTF-8
[DEBUG] (f) session = org.apache.maven.execution.MavenSession@2e6e1367
[DEBUG] (f) supportMultiLineFiltering = false
[DEBUG] (s) useCache = true
[DEBUG] (f) useDefaultDelimiters = true
[DEBUG] (f) useJvmChmod = true
[DEBUG] (s) warSourceDirectory = /home/jboss/.jenkins/jobs/subco/workspace/myprojecct/src/main/webapp
[DEBUG] (s) warSourceIncludes = **
[DEBUG] (s) webappDirectory = /home/jboss/.jenkins/jobs/subco/workspace/myprojecct/target/myprojecct
[DEBUG] (s) workDirectory = /home/jboss/.jenkins/jobs/subco/workspace/myprojecct/target/war/work
[DEBUG] -- end configuration --
[INFO] Generating webapp in source directory [/home/jboss/.jenkins/jobs/subco/workspace/myprojecct/src/main/webapp]
[Fatal Error] :3144:24: XML document structures must start and end within the same entity.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 38.926 s
[INFO] Finished at: 2016-10-05T16:41:46+00:00
[INFO] Final Memory: 17M/56M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:3.0.0:inplace (war-inplace) on project myprojecct: Execution war-inplace of goal org.apache.maven.plugins:maven-war-plugin:3.0.0:inplace failed. StreamException: XML document structures must start and end within the same entity. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-war-plugin:3.0.0:inplace (war-inplace) on project myprojecct: Execution war-inplace of goal org.apache.maven.plugins:maven-war-plugin:3.0.0:inplace failed.
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:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
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.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution war-inplace of goal org.apache.maven.plugins:maven-war-plugin:3.0.0:inplace failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: com.thoughtworks.xstream.io.StreamException:
at com.thoughtworks.xstream.io.xml.DomDriver.createReader(DomDriver.java:115)
at com.thoughtworks.xstream.io.xml.DomDriver.createReader(DomDriver.java:80)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1085)
at org.apache.maven.plugins.war.util.WebappStructureSerializer.fromXml(WebappStructureSerializer.java:78)
at org.apache.maven.plugins.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:432)
at org.apache.maven.plugins.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:406)
at org.apache.maven.plugins.war.WarInPlaceMojo.execute(WarInPlaceMojo.java:44)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 21 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 3144; columnNumber: 24; XML document structures must start and end within the same entity.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347)
at com.thoughtworks.xstream.io.xml.DomDriver.createReader(DomDriver.java:108)
... 28 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
编辑:根据给出的建议,这些是我的项目目录中接近3000行的文件。没有XML文件
14987。/src/main/webapp/资源/js/jquery . svn/支持/jquery-ui.js.svn-base14987。/src/main/webapp/资源/js/jquery/jquery-ui.js14879。/src/main/webapp/资源/js/jquery . svn/支持/jquery-ui-1.9.2.custom.js.svn-base14879。/src/main/webapp/资源/js/jquery/jquery-ui-1.9.2.custom.js14306。/src/main/webapp/资源/css/. svn/支持/springboard.css.svn-base14306。/src/main/webapp/资源/css/springboard.css9597。/src/main/webapp/资源/js/jquery . svn/支持/jquery-1.9.1.js.svn-base9597。/src/main/webapp/资源/js/jquery/jquery-1.9.1.js5774。/src/main/webapp/资源/引导/css/. svn/支持/bootstrap.css.svn-base5774。/src/main/webapp/资源/引导/css/bootstrap.css2026。/src/main/webapp/资源/引导/js/. svn/支持/bootstrap.js.svn-base
项目中的一个xml文件有一个未关闭的标记。默认情况下,inplace
目标引用src/main/webapp
目录(或webappDirectory
目录)中的文件。所以错误的文件很可能在里面。查找>3143
行长度的文件
如果你没有这样的文件,它可能在依赖项中