我如何弄清楚Maven war插件" XML文档结构必须在同一个实体内开始和结束的文件"在抱怨?

时间:2016-10-05 16:50:15

标签: maven maven-3 maven-war-plugin in-place

我在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/resources/js/jquery/.svn/text-base/jquery-ui.js.svn-base    14987 ./src/main/webapp/resources/js/jquery/jquery-ui.js    14879 ./src/main/webapp/resources/js/jquery/.svn/text-base/jquery-ui-1.9.2.custom.js.svn-base    14879 ./src/main/webapp/resources/js/jquery/jquery-ui-1.9.2.custom.js    14306 ./src/main/webapp/resources/css/.svn/text-base/springboard.css.svn-base    14306 ./src/main/webapp/resources/css/springboard.css     9597 ./src/main/webapp/resources/js/jquery/.svn/text-base/jquery-1.9.1.js.svn-base     9597 ./src/main/webapp/resources/js/jquery/jquery-1.9.1.js     5774 ./src/main/webapp/resources/bootstrap/css/.svn/text-base/bootstrap.css.svn-base     5774 ./src/main/webapp/resources/bootstrap/css/bootstrap.css     2026 ./src/main/webapp/resources/bootstrap/js/.svn/text-base/bootstrap.js.svn-base

1 个答案:

答案 0 :(得分:-1)

项目中的一个xml文件有一个未关闭的标记。 inplace目标默认引用src/main/webapp目录中的文件(或webappDirectory目录)。所以错误的文件可能在那里。查找>3143行长的文件。

如果您没有此类文件,则可能是依赖项。