我正在关注入门版0.9。我可以使用完整的“java -Duser.lan ...”命令运行示例应用程序,然后双击foo.jar,但是当我尝试使用mvn exec:exec替代它时,它不起作用。
这是控制台中的错误:
CI0011766:drombler-test-application claudiorosati$ mvn exec:exec
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building drombler-test-application 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.5.0:exec (default-cli) @ drombler-test-application ---
Error: Could not find or load main class Projects.drombler-test.drombler-test-application.target.deployment.standalone.conf.logging.properties
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:764)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:711)
at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:289)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
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:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
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)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.809 s
[INFO] Finished at: 2017-03-08T11:46:48+01:00
[INFO] Final Memory: 24M/981M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:exec (default-cli) on project drombler-test-application: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [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
这里是测试应用程序模块的pom文件部分:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<commandlineArgs>${additionalExecArgs} -Duser.language=en -Duser.country=US -Djavafx.verbose=true -Dbinary.css=false -Djava.util.logging.config.file=${project.build.directory}/deployment/standalone/conf/logging.properties -jar ${project.build.directory}/deployment/standalone/bin/foo.jar --userdir ${project.build.directory}/userdir</commandlineArgs>
<executable>java</executable>
<classpathScope>runtime</classpathScope>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.drombler.fx</groupId>
<artifactId>drombler-fx-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<brandingId>foo</brandingId>
<title>MyApplication ${project.version}</title>
<width>1500</width>
<height>1000</height>
<!--Uncomment the following line and specifcy an unused port to create a single instance application -->
<!--<defaultSingleInstancePort>some unused port</defaultSingleInstancePort>-->
</configuration>
</plugin>
</plugins>
</build>
答案 0 :(得分:1)
[DEBUG]执行命令行:[java,-Duser.language = en, -Duser.country = US,-Djavafx.verbose = true,-Dbinary.css = false,-Djava.util.logging.config.file = / Users / claudiorosati / Projects / NetBeans, 项目/ drombler测试/ drombler测试的应用程序/目标/部署/独立/ CONF / logging.properties, -jar,/ Users / claudiorosati / Projects / NetBeans,Projects / drombler-test / drombler-test-application / target / deployment / standalone / bin / foo.jar, --userdir,/ Users / claudiorosati / Projects / NetBeans,Projects / drombler-test / drombler-test-application / target / userdir] 错误:找不到或加载主类 Projects.drombler-test.drombler-test-application.target.deployment.standalone.conf.logging.properties [ERROR]命令执行失败。 org.apache.commons.exec.ExecuteException:进程退出时带有 错误:1(退出值:1)
看起来路径有空格存在问题。
请尝试以下方法:
<commandlineArgs>${additionalExecArgs} -Duser.language=en -Duser.country=US -Djavafx.verbose=true -Dbinary.css=false -Djava.util.logging.config.file="${project.build.directory}/deployment/standalone/conf/logging.properties" -jar "${project.build.directory}/deployment/standalone/bin/foo.jar" --userdir "${project.build.directory}/userdir"</commandlineArgs>