2013/07/17

java -jar にて実行可能な jar ファイルを作成するための pom.xml 設定

executable jar が作成したかったので調べた。
classpathPrefix でクラスパスを通すディレクトリを指定できるのはかなり便利だと思う。
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>jp.mkt_sys.maven.tips</groupId>
<artifactId>some_app</artifactId>
<version>1.0.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<!-- main メソッドが存在するクラス -->
<mainClass>jp.mkt_sys.maven.tips.some_app.Runner</mainClass>
<addClasspath>true</addClasspath>
<!-- classpath を通したいディレクトリ(相対指定)-->
<classpathPrefix>lib</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- some dependency settings -->
</dependencies>
</project>
view raw pom.xml hosted with ❤ by GitHub

0 件のコメント :

コメントを投稿