3

I'm trying to generate an uber jar in a multi module project with the maven-shade plugin with no success.
Versions: maven v3.9, maven-shade v3.0

The project looks as follow:

main
|- library
|- admin
|- ...

The sub module "admin" inherits (dependency) the sub module "library" and contains the maven-shade plugin definition. During the building process the plugin doesn't seem to find the POM of the local sub module "library".

Here are the poms

main pom.xml
<groupId>tapmeppe.server</groupId>
<artifactId>tapmeppe-server</artifactId>
<version>2017.1</version>
<packaging>pom</packaging>
<modules>
    <module>library</module>
    <module>admin</module>
    <module>core</module>
</modules>
...


library pom.xml
<parent>
    <groupId>tapmeppe.server</groupId>
    <artifactId>tapmeppe-server</artifactId>
    <version>2017.1</version>
</parent>

<artifactId>tapmeppe-server-library</artifactId>

<dependencies>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.38</version>
    </dependency>
    <dependency><!--jdbc driver-->
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>4.2.5.RELEASE</version>
    </dependency>
    <dependency><!--JSON parser-->
        <groupId>com.typesafe.play</groupId>
        <artifactId>play_2.11</artifactId>
        <version>2.5.2</version>
    </dependency>
</dependencies>


admin pom.xml
<parent>
    <groupId>tapmeppe.server</groupId>
    <artifactId>tapmeppe-server</artifactId>
    <version>2017.1</version>
</parent>

<artifactId>tapmeppe-server-admin</artifactId>

<dependencies>
    <dependency>
        <groupId>tapmeppe.server</groupId>
        <artifactId>tapmeppe-server-library</artifactId>
        <version>${project.version}</version>
    </dependency>
</dependencies>

<build>
    <finalName>admin-${project.version}</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.0</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <shadedArtifactAttached>true</shadedArtifactAttached>
                        <minimizeJar>true</minimizeJar>
                        <transformers>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>tapmeppe.admin.Starter</mainClass>
                            </transformer>
                        </transformers>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Here is the output of the build

[INFO] Scanning for projects...
...

[WARNING] The POM for tapmeppe.server:tapmeppe-server-library:jar:2017.1 is missing, no dependency information available

...

[ERROR] Failed to execute goal on project tapmeppe-server-admin: Could not resolve dependencies for project tapmeppe.server:tapmeppe-server-admin:jar:2017.1: Failure to find tapmeppe.server:tapmeppe-server-library:jar:2017.1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

For some reason the plugin is looking for the dependency jar in the remote repository instead of using the sub module. What am I missing? Thanks for the help.

tapmeppe
  • 41
  • 2
  • 8
  • Does this work without the shade plugin? Are you running maven from admin directory or the main directory? And if from admin directory - IS the library avalable, installed in local repository? – Deltharis Feb 14 '17 at 13:36
  • I finally solved the problem thanks to the following answer: http://stackoverflow.com/a/19525334/2652918 – tapmeppe Feb 14 '17 at 16:44

0 Answers0