Maven XML构建失败

时间:2018-10-11 11:45:23

标签: java maven xmlbeans

运行mvn xmlbeans:xmlbeans时出现以下错误

我使用的是Maven 3.5.0版

D:\ home \ Code \ abc-xmlbeans> mvn全新安装

D:\ home \ Code \ abc-xmlbeans> mvn castor:generate

工作正常 唯一的问题是以下错误:

D:\home\Code\abc-xmlbeans>mvn xmlbeans:xmlbeans
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building WBILL XMLBEANS 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- xmlbeans-maven-plugin:2.3.3:xmlbeans (default-cli) @ abc-xmlbeans ---
java.io.IOException: Cannot run program "D:\home\Code\abc-xmlbeans\javac": CreateProcess error=2, The system cannot find the file specified
java.io.IOException: CreateProcess error=2, The system cannot find the file specified
java.io.IOException: Cannot run program "D:\home\Code\abc-xmlbeans\javac": CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessBuilder.start(Unknown Source)
        at java.lang.Runtime.exec(Unknown Source)
        at java.lang.Runtime.exec(Unknown Source)
        at org.apache.xmlbeans.impl.tool.CodeGenUtil.externalCompile(CodeGenUtil.java:231)
        at org.apache.xmlbeans.impl.tool.SchemaCompiler.compile(SchemaCompiler.java:1154)
        at org.codehaus.mojo.xmlbeans.AbstractXmlBeansPlugin.execute(AbstractXmlBeansPlugin.java:280)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
        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:309)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        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: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(Unknown Source)
        at java.lang.ProcessImpl.start(Unknown Source)
        ... 28 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.688 s
[INFO] Finished at: 2018-10-11T16:52:57+05:30
[INFO] Final Memory: 10M/212M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:xmlbeans-maven-plugin:2.3.3:xmlbeans (default-cli) on project abc-xmlbeans: XmlBeans compile failed:
[ERROR]  xml ErrorLoading schema file D:\home\Code\abc-xmlbeans\src\main\xsd\List1.xsd
[ERROR] xml ErrorLoading schema file D:\home\Code\abc-xmlbeans\src\main\xsd\List2.xsd
[ERROR] xml ErrorLoading schema file D:\home\Code\abc-xmlbeans\src\main\xsd\List3.xsd
[ERROR] xml ErrorLoading schema file D:\home\Code\abc-xmlbeans\src\main\xsd\List4.xsd
[ERROR] xml ErrorLoading schema file D:\home\Code\abc-xmlbeans\src\main\xsd\List5.xsd
[ERROR] xml ErrorLoading schema file D:\home\Code\abc-xmlbeans\src\main\xsd\List6.xsd
[ERROR]
[ERROR] -> [Help 1]
[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/MojoExecutionException

有人可以帮助我解决此问题吗?

谢谢 伊扎兹

1 个答案:

答案 0 :(得分:0)

转到您的pom.xml,其中将包含xmlbeans-maven-plugin的定义信息。

只需在其定义中添加配置:

<configuration>

                <compiler>Path to your javac.exe....</compiler>
</configuration>