Maven配置文件:XML声明仅允许作为文档中的第一个节点

时间:2018-02-19 02:22:56

标签: xml maven

我有一种奇怪的maven行为,具体取决于个人资料。

此命令(个人资料' deploiement')无效:

$ mvn -f dsf-parent/pom.xml clean -DskipTests -P deploiement
[INFO] Scanning for projects...
[ERROR] Internal error: de.pdark.decentxml.XMLParseException: Line 1, column 9: An XML declaration is only allowed as the first node in the document -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: de.pdark.decentxml.XMLParseException: Line 1, column 9: An XML declaration is only allowed as the first node in the document
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:121)
        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:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        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: de.pdark.decentxml.XMLParseException: Line 1, column 9: An XML declaration is only allowed as the first node in the document
        at de.pdark.decentxml.Document.addNode(Document.java:148)
        at de.pdark.decentxml.Document.addNode(Document.java:53)
        at de.pdark.decentxml.NodeWithChildren.addNode(NodeWithChildren.java:53)
        at de.pdark.decentxml.Document.addNode(Document.java:73)
        at de.pdark.decentxml.XMLParser.parse(XMLParser.java:155)
        at org.eclipse.tycho.model.Feature.read(Feature.java:213)
        at org.eclipse.tycho.model.Feature.read(Feature.java:208)
        at org.eclipse.tycho.model.Feature.loadFeature(Feature.java:266)
        at org.eclipse.tycho.core.osgitools.EclipseFeatureProject.setupProject(EclipseFeatureProject.java:53)
        at org.eclipse.tycho.core.resolver.DefaultTychoResolver.setupProject(DefaultTychoResolver.java:74)
        at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:90)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:266)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        ... 11 more
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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/InternalErrorException

此命令有效(个人资料' dev'):  mvn -f dsf-parent / pom.xml clean -DskipTests -P dev

无法找到原因......

整个xml在这里:https://justpaste.it/1ha4r

1 个答案:

答案 0 :(得分:0)

找到解决方案:

事实证明问题不是在pom.xml中,而是在另一个xml中,在一个模块中(由'deploiement'而不是'dev'调用)