2009年8月11日火曜日

maven-jar-pluginを利用してMANIFEST作成

maven-jar-pluginを利用してMANIFEST作成方法

実行可能なJARを作成するとき便利。


<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
        <archive>
            <manifest>
                <addClasspath>true</addClasspath>
                <classpathPrefix>lib/</classpathPrefix>
                <mainClass>com.babukuma.test.Main</mainClass>
            </manifest>
        </archive>
    </configuration>
</plugin>


作ったMANIFESTは


Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: BABUKUMA
Build-Jdk: 1.6.0_14
Main-Class: com.babukuma.test.Main
Class-Path: lib/postgresql-8.3-603.jdbc4.jar lib/WisCommon-0.9.16.jar
lib/jsonic-1.1.0.jar lib/log4j-1.2.8.jar lib/s2-framework-2.4.39.jar
lib/aopalliance-1.0.jar lib/javassist-3.4.ga.jar lib/ognl-2.6.9-patch
-20090427.jar lib/commons-logging-1.1.jar lib/s2-extension-2.4.39.jar
lib/poi-3.0-FINAL.jar lib/s2-tiger-2.4.39.jar lib/easymock-2.2.jar l
ib/s2-dao-1.0.50.jar lib/s2-dao-tiger-1.0.50.jar lib/commons-lang-2.4
.jar lib/geronimo-jta_1.1_spec-1.1.1.jar lib/geronimo-jpa_3.0_spec-1.
1.1.jar lib/commons-email-1.1.jar lib/mail-1.4.jar lib/activation-1.1
.jar lib/commons-cli-1.2.jar