http://www.sonatype.com/people/2009/08/how-to-make-an-executable-jar-in-maven/

On Tue, Mar 2, 2010 at 5:19 PM, Sufie Seifoddini <[email protected]> wrote:
> Hello,
>
> In order to create an exectuable jar file, I have added the below to my pom.  
> This does package all the dependencies in the jar but does not put the main 
> class or class path in the manifest file.  Please advise.  Do I need to hand 
> create and add the manifest?  I am using maven 2
>
> <build>
>         <plugins>
>            <plugin>
>               <artifactId>maven-compiler-plugin</artifactId>
>               <configuration>
>                  <source>${jdk.version}</source>
>                  <target>${jdk.version}</target>
>                  <encoding>UTF-8</encoding>
>                  <debug>true</debug>
>                  <optimize>false</optimize>
>               </configuration>
>            </plugin>
>
>            <plugin>
>               <groupId>org.apache.maven.plugins</groupId>
>               <artifactId>maven-jar-plugin</artifactId>
>               <configuration>
>                  <archive>
>                     <manifest>
>                        <addClasspath>true</addClasspath>
>                        <mainClass>path.to.main</mainClass>
>                     </manifest>
>                  </archive>
>                </configuration>
>            </plugin>
>            <plugin>
>               <groupId>org.apache.maven.plugins</groupId>
>               <artifactId>maven-assembly-plugin</artifactId>
>               <configuration>
>                  <descriptorRefs>
>                     <descriptorRef>jar-with-dependencies</descriptorRef>
>                  </descriptorRefs>
>               </configuration>
>
>              <executions>
>                  <execution>
>                    <id>make-my-jar-with-dependencies</id>
>                    <phase>package</phase>
>                    <goals>
>                       <goal>single</goal>
>                  </goals>
>                 </execution>
>              </executions>
>            </plugin>
>         </plugins>
>      </build>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to