Failure to run Java code using `exec-maven-plugin` within IntelliJ

98 Views Asked by At

I have a Maven project which I am using with IntelliJ v2023.1.1. The code builds using the mvn compile command, and the code runs correctly outside of Maven when run with the java SimpleTest.java command.

Yet, when I attempt to run the same code within IntelliJ, using the command

mvn -e -q exec:java -P"SimpleTest"

I get the error...

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) on project carlca: 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:3.0.0:exec (default-cli) on project carlca: Command execution failed.

I'm reasonably sure that the pom.xml is correct, because I restored it from a saved Git push, which was done yesterday when everything was working!

The problem appears to have been introduced when I inadvertently deleted a node in another project which referenced this project. The node was deleted from the External Libraries panel. I was able to rebuild the other project so that it builds and runs.

So, in summary, both projects build and run outside of Maven, but one project fails when individual classes are attempted to be run via Maven.

0

There are 0 best solutions below