0

I want to compile all my .jars into a final .jar with Maven shade plugin. This works partially, but Maven is not including all the dependencies in the uberjar. (These questions didn't help me: here and here).

From the output I can see that it is including all the maven dependencies, but not my custom packages(someCustomPackage.jar e.g.), for example:

....
[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.
....

But it doesn't say anything about the someCustomPackage. This is how the dependencies start (I try to summarize the important parts of the 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>

What am I missing in the pom.xml? Should I mention the someCustomPackage explicitly? Or is it something different...

Thanks in advance!

Community
  • 1
  • 1
DA--
  • 723
  • 1
  • 8
  • 20
  • 1
    Wherever you read that you should use `system` to depend on "local" artifacts not present on Maven repositories, don't trust that source anymore. – Tunaki Nov 09 '16 at 15:39
  • Thank you, that was indeed incorrect! I solved it by installing them to a local repository and changing the scope. – DA-- Nov 10 '16 at 08:44
  • In my opinion, it is not an exact duplicate, as installing it to a local repository is a good solution to my problem. – DA-- Nov 10 '16 at 08:47
  • 1
    Actually, it's really the only solution -- apart from using a repository manager. `system` is probably going to be removed in future releases. – Tunaki Nov 10 '16 at 08:48

0 Answers0