2010年6月10日木曜日

Mavenからアプリを実行する

以下のように記述し、exec:exec とする。

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<!-- automatically creates the classpath using all project dependencies,
also adding the project build directory -->
<classpath/>
<argument>net.korabo.lib.h2ctrl.App</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

MavenのThreadで動作するJavaアプリの場合は、以下のように記述し、exec:java

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>net.korabo.lib.h2ctrl.App</mainClass>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

0 件のコメント: