2017-03-08 73 views
1

我正在使用入門版本0.9。我可以用完整的「java -Duser.lan ...」命令運行示例應用程序,然後雙擊foo.jar,但是當我嘗試使用mvn exec:exec時,它不起作用。使用「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

請提供以下信息:操作系統版本,Java版本(Java的版本),Maven的版本(MVN -version)。是否設置了環境變量(JAVA_HOME,M2_HOME)? – Puce

+0

也請使用-X -e標誌運行Maven命令以獲取更多日誌輸出。 – Puce

+0

肯定:
- OS:MacOS X系統10.12.3
- Java的:1.8.0_121
- Maven的:3.3.9
- 信封瓦爾:JAVA_HOME,M2_HOME和M2設定。

回答

1

[DEBUG] Executing command line: [java, -Duser.language=en, -Duser.country=US, -Djavafx.verbose=true, -Dbinary.css=false, -Djava.util.logging.config.file=/Users/claudiorosati/Projects/NetBeans, Projects/drombler-test/drombler-test-application/target/deployment/standalone/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] 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)

它看起來像有一個與路徑的問題有空間。

請嘗試以下方法:

<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> 
+0

這解決了這個問題。謝謝。 你可以在下一個版本中添加它嗎? –

+0

對於即將發佈的版本,exec插件的默認配置有所改變。我不確定是否仍然需要此修復程序,但是我會仔細檢查是否支持帶空格的路徑:https://github.com/Drombler/drombler-fx/blob/develop/drombler-fx-maven-archetype -application/src/main/resources/archetype-resources/__ rootArtifactId __- application/pom.xml#L34 – Puce

+0

我在這裏提交了一個問題:https://github.com/Drombler/drombler-fx/issues/180 – Puce

相關問題