在 Maven 阴影 jar 中包含测试类

时间:2021-06-06 06:54:26

标签: maven maven-shade-plugin

如何使用 maven shaded 插件生成带有测试类的胖 jar?以下不包括测试类。

 <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <filters>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                  </excludes>
                </filter>
              </filters>
              <transformers>
                <transformer
                  implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>com.someMainClass</mainClass>
                </transformer>
              </transformers>
              <finalName>finalName</finalName>
            </configuration>
          </execution>
        </executions>
      </plugin>

0 个答案:

没有答案