Running the sample application using “mvn exec:exec” doesn't work

家住魔仙堡 提交于 2019-12-02 08:38:29

问题


I'm following the Getting Started version 0.9. I can run the sample application with the full "java -Duser.lan..." command and the double-click on the foo.jar, but when I try the mvn exec:exec alternative it doesn't work.

Here the error in console:

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

Here the section of the pom file of the test-application module:

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

回答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)

It looks like there is an issue with paths which have spaces.

Please try the following:

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


来源:https://stackoverflow.com/questions/42669251/running-the-sample-application-using-mvn-execexec-doesnt-work

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!