I tried to re-run my maven project in another laptop with the exact same file. I compiled it with this command:
mvn exec:java -Dexec.mainClass=id.tumbs.App
This works on the laptop I was doing the project for, while throwing out an error on another laptop. The error code is
[ERROR] Unknown lifecycle phase ".mainClass=id.tumbs.App". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [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/LifecyclePhaseNotFoundException
I tried everything from what the error link told me and nothing work. Any solution, please?
Try specifying your main class in double quotes:
mvn exec:java -Dexec.mainClass="id.tumbs.App"
Similarly, you can use -Dexec.args="arg0 arg1"
to pass arguments.
If you're on Windows, you need to apply quotes for exec.mainClass and exec.args:
mvn exec:java -D"exec.mainClass"="id.tumbs.App"
If you're doing this more frequently, you can add the parameters into the pom.xml like this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>id.tumbs.App</mainClass>
<arguments>
<argument>arg0</argument>
<argument>arg1</argument>
</arguments>
</configuration>
</plugin>
If you're interested in knowing more details about this, take a look at the maven-exec-plugin.