Don't fork me!

Travis CI status: Build Status

1. Introduction

This project contains example of maven-shade-pluginn usage

Project generated by generator-jvm yeoman generator (java)

2. Implementation

java example
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class App {
  public static void main(String[] args) {
    log.info("yo!");
  }
}
plugion configuration
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="
         http://maven.apache.org/POM/4.0.0
         http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.1.1</version>
        <configuration>
          <shadedArtifactAttached>true</shadedArtifactAttached>
          <shadedClassifierName>all</shadedClassifierName>
          <transformers>
            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
              <manifestEntries>
                <Main-Class>daggerok.App</Main-Class>
                <X-Compile-Source-JDK>${maven.compiler.source}</X-Compile-Source-JDK>
                <X-Compile-Target-JDK>${maven.compiler.target}</X-Compile-Target-JDK>
              </manifestEntries>
            </transformer>
          </transformers>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <defaultGoal>clean package</defaultGoal>
  </build>
</project>

3. Test usage

build fat jar
./mvnw clean package
run app
java -jar ./target/*-all.jar

4. Build documentation

build documentation
./mvnw process-resources