Tuesday, December 17, 2013

Using maven to create executable jar file

 To create executable jar file with maven all you need to do is to add the corresponding plugin description to your pom.xml file. Shade plugin is what we need!

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.0</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                <transformer implementation="org.apache.maven.

plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>com.vbashur.trying.threads.App</mainClass>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>

No comments:

Post a Comment