Maven shade插件不包括自定义依赖项

时间:2016-11-09 15:38:44

标签: java maven pom.xml maven-shade-plugin

我想将所有.jars编译成带有Maven shade插件的最终.jar。这部分工作,但Maven不包括uberjar中的所有依赖项。 (这些问题对我没有帮助:herehere)。

从输出中我可以看到它包含所有maven依赖项,但不包括我的自定义包(例如someCustomPackage.jar),例如:

....
[INFO] Including xpp3:xpp3:jar:1.1.3.3 in the shaded jar.
[INFO] Including org.json:json:jar:20140107 in the shaded jar.
[INFO] Including net.sf.saxon:Saxon-HE:jar:9.7.0-7 in the shaded jar.
....

但它并没有对someCustomPackage说些什么。 这就是依赖关系的开始(我尝试总结pom.xml的重要部分):

 ...
 <someCustomPackage.path>${basedir}/lib/someCustomPackage-1.0.jar</someCustomPackage.path>
 ...
 <dependencies>
    <dependency>
        <groupId>someCustomPackage</groupId>
        <artifactId>myArtifact</artifactId>
        <version>1.0</version>
        <scope>system</scope>
        <systemPath>${someCustomPackage.path}</systemPath>
    </dependency>
      <!--Maven dependencies-->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
    etc...

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>2.3</version>
    <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>myArtifact</mainClass>
                    </transformer>
                </transformers>
            </configuration>
        </execution>
    </executions>
</plugin>

pom.xml中缺少什么?我应该明确提到someCustomPackage吗?或者它是不同的......

提前致谢!

0 个答案:

没有答案