Executable jar 를 메이븐 exec:exec 로 실행 하기
Executable JAR 빌드 후 메이븐 exec:exec 로 실행하고 싶다면 exec-maven-plugin 을 사용할 수 있다. [code xml]<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<!-- optional -->
<workingDirectory>/tmp</workingDirectory>
<arguments>
<argument>-jar</argument>
<argument>${basedir}/target/${project.artifactId}-${project.version}.jar</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>[/code]
mvn exec:exec 가 아닌 mvn exec:java 로 컴파일 output 디렉토리에서 main class를 바로 실행하고 싶다면 다음과 같이 설정한다.
[code xml]<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
<configuration>
<mainClass>com.app.MainClass</mainClass>
<arguments></arguments>
</configuration>
</executions>
</executions>
</plugin> [/code]
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<!-- optional -->
<workingDirectory>/tmp</workingDirectory>
<arguments>
<argument>-jar</argument>
<argument>${basedir}/target/${project.artifactId}-${project.version}.jar</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>[/code]
mvn exec:exec 가 아닌 mvn exec:java 로 컴파일 output 디렉토리에서 main class를 바로 실행하고 싶다면 다음과 같이 설정한다.
[code xml]<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
<configuration>
<mainClass>com.app.MainClass</mainClass>
<arguments></arguments>
</configuration>
</executions>
</executions>
</plugin> [/code]
Trackback Address:이 글에는 트랙백을 보낼 수 없습니다