Adding Main class to Maven Jar output

23. November 2008

To set the Main class in a Jar file created as output in a Maven project the following is needed in the pom.xml file.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-jar-plugin</artifactId>
  <configuration>
    <archive>
      <manifest>
        <mainClass>com.someclass.Main</mainClass>
        <packageName>com.someclass</packageName>
      </manifest>
      <manifestEntries>
        <mode>development</mode>
        <url>${pom.url}</url>
      </manifestEntries>
    </archive>
  </configuration>
</plugin>

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Maven

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading