albfan / mvnexec

bash script to find and execute java classes with main methods
18 stars 12 forks source link

Execute on parent project #4

Open bikashg opened 7 years ago

bikashg commented 7 years ago

Gives error :

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:exec (default-cli) on project srl: Execution default-cli of goal org.codehaus.mojo:exec-maven-plugin:1.5.0:exec failed: Executable can not be empty -> [Help 1] even though I specified the number of the main class to run.

even though I specified the number of the main class to run.

albfan commented 7 years ago

I recall that is related to environment (maven, jdk) What are yours exactly? what OS are you using?

You can run script it in debug mode to see exactly the problem

https://github.com/albfan/mvnexec/blob/master/mvnexec#L8

so if you are using it as mvnexec

$ mvnexec_DEBUG=1 mvnexec

should show a first sight of what's happening

$ mvnexec_DEBUG=10 mvnexec

for real verbose output

If those tricks don't help change mvn to mvn -X here

https://github.com/albfan/mvnexec/blob/master/mvnexec#L127

for mvn direct info

Maybe is time to add a --debug option to execute as mvn -X on demand

zangshayang1 commented 7 years ago

Mac OS Maven 3.5.0 Java 1.8.0_131

Still run into the same problem.

albfan commented 7 years ago

Post the output of:

$ mvnexec_DEBUG=10 mvnexec

to see what's happening

zangshayang1 commented 7 years ago

I ran the -X mode and got the following:

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:exec (setuptools-test) on project beam-sdks-python: Command execution failed.: Process exited with an error: 1 (Exit value: 1) -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:exec (setuptools-test) on project beam-sdks-python: Command execution failed. at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213) 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(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: org.apache.maven.plugin.MojoExecutionException: Command execution failed. at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:302) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 20 more Caused by: 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) ... 22 more [ERROR] [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 [ERROR]

I tried mvnexec and it says it cannot find main class.

Thanks.

albfan commented 7 years ago

Do you have a link for project you are trying? beam-sdks-python seems to be a python project.

Anyway I should check how mvnexec behaves under project without classes with a "public static void main" method

zangshayang1 commented 7 years ago

Here is the project link: https://github.com/apache/beam.

I've cleaned local maven repository, re-installed maven-3.5.0, re-cloned the master branch and re-run $ mvn clean verify. Same error.

Thanks.

albfan commented 7 years ago

Now we have triage the problem

See by now it only search on single projects (src/{main,test}/java)

https://github.com/albfan/mvnexec/blob/master/mvnexec#L221

And this one have nested maven projects

Let me think of how to deal with this cases

Thanks for reporting