0

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.

  • Are you running a test via exec-maven-plugin? Is that class SimpleTest.java a unit test? – khmarbaise May 16 '23 at 06:17
  • That's a generic error, that doesn't really point to the root cause, unfortunately... Can you remove "-q" key (or even add "-X" key) and post full Maven output? Also, it seems you are using IDE's Terminal - can you try running the same goal via Intellij's Maven Tool Window? Does it produce the same results? What happens if you run the same command via a regular OS console (outside of Intellij)? – romanv-jb May 16 '23 at 07:54

0 Answers0