Часто после сборки приложения его нужно сразу запустить. Для этого добавим плагин exec-maven-plugin
в pom.xml
:
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> ... <build> <plugins> ... <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <configuration> <mainClass>ru.yourProject.mainClass</mainClass> <arguments> <argument>-Dproperty=first</argument> <argument>-Dproperty=second</argument> </arguments> </configuration> </plugin> ... </plugins> </build> </project>
Запустить просто:
mvn exec:java