You can run the jar file using the exec:java
target by adding a few arguments
:
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.3.2</version> <configuration> <mainClass>org.example.Main</mainClass> <arguments> <argument>-jar</argument> <argument>target/myJar-1.0-SNAPSHOT.jar</argument> </arguments> </configuration> </plugin>
If you have an executable jar and you do not want to define an entry point, you need to set executable
and use the exec:exec
target:
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.3.2</version> <configuration> <executable>java</executable> <arguments> <argument>-jar</argument> <argument>target/myJar-1.0-SNAPSHOT.jar</argument> </arguments> </configuration> </plugin>
source share