Maven assembly plugin not loading dependency from local repository

1.4k views Asked by At

I am trying to build a parent project containing several sub-modules and a "packaging" sub-module - exactly as described under https://maven.apache.org/plugins/maven-assembly-plugin/examples/multimodule/module-binary-inclusion-simple.html

The sub-modules get built and installed in the local repository, but when the "packaging" sub-module gets built, maven complains about not being able to find one of the other sub-modules - instead it tries to download it from the Central Maven Nexus (where it can't find it, of course).

Anyone have an idea what I could be missing?

package/pom.xml:

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>group</groupId>
    <artifactId>parent</artifactId>
    <version>CURRENT</version>
  </parent>
  <groupId>group</groupId>
  <artifactId>package</artifactId>
  <version>CURRENT</version>
  <packaging>pom</packaging>
  <name>package module</name>
  <properties>
    <project.reporting.outputEncoding>ISO-8859-15</project.reporting.outputEncoding>
    <project.build.sourceEncoding>ISO-8859-15</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <dependency>
      <groupId>group</groupId>
      <artifactId>common</artifactId>
      <version>CURRENT</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>group</groupId>
      <artifactId>metaserviceclient</artifactId>
      <version>CURRENT</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>group</groupId>
      <artifactId>hierarchyclient</artifactId>
      <version>CURRENT</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>

      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <id>distro-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>package.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

package/package.xml

<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
    <id>bin</id>
    <formats>
        <format>dir</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <moduleSets>
        <moduleSet>
            <useAllReactorProjects>true</useAllReactorProjects>
            <includes>
                <include>group:*</include>
            </includes>
            <binaries>
                <includeDependencies>true</includeDependencies>
                <unpack>false</unpack>
                <outputDirectory>opt/lib</outputDirectory>
                <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping>
            </binaries>
        </moduleSet>
    </moduleSets>
</assembly>

hierarchyclient/pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>group</groupId>
    <artifactId>hierarchyclient</artifactId>
    <name>Hierarchy client</name>
    <parent>
        <groupId>group</groupId>
        <artifactId>parent</artifactId>
        <version>CURRENT</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>xom</groupId>
            <artifactId>xom</artifactId>
            <version>1.2.5</version>
        </dependency>
        <dependency>
            <groupId>group</groupId>
            <artifactId>common</artifactId>
            <version>CURRENT</version>
        </dependency>
        <dependency>
            <groupId>junit-addons</groupId>
            <artifactId>junit-addons</artifactId>
            <version>1.4</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>parent</artifactId>
    <groupId>group</groupId>
    <version>CURRENT</version>
    <packaging>pom</packaging>

    <modules>
        <module>hierarchyclient</module>
        <module>common</module>
        <module>metaserviceclient</module>
        <module>package</module> <!-- responsible for package preparation -->
    </modules>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <fork>true</fork>
                    <compilerVersion>1.8</compilerVersion>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <project.build.sourceEncoding>ISO-8859-15</project.build.sourceEncoding>
        <project.reporting.outputEncoding>ISO-8859-15</project.reporting.outputEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

maven output:

[15:27:28][INFO] --- maven-install-plugin:2.3.1:install (default-install) @ hierarchyclient ---

[15:27:28][INFO] Installing /opt/frisk/teamcity_prd1/work/ac40d96bc266d196/hierarchyclient/target/hierarchyclient-CURRENT.jar to /opt/frisk/home/friskpkg/.m2/repository/group/hierarchyclient/CURRENT/hierarchyclient-CURRENT.jar

[15:27:28][INFO] Installing /opt/frisk/teamcity_prd1/work/ac40d96bc266d196/hierarchyclient/pom.xml to /opt/frisk/home/friskpkg/.m2/repository/group/hierarchyclient/CURRENT/hierarchyclient-CURRENT.pom

and later

[15:27:31][group:package] Downloading: http://$REPOSITORY/nexus/content/groups/public/group/hierarchyclient/CURRENT/hierarchyclient-CURRENT.pom

[15:27:31][group:package] Downloading: http://repo.maven.apache.org/maven2/coba/frisk/legacy/hierarchyclient/CURRENT/hierarchyclient-CURRENT.pom

[15:27:31][group:package] Failed to execute goal on project package: Could not resolve dependencies for project group:package:pom:CURRENT: Failed to collect dependencies for [group:common:jar:CURRENT (compile), group:metaserviceclient:jar:CURRENT (compile), group:hierarchyclient:jar:CURRENT (compile), junit:junit:jar:4.12 (test)]
0

There are 0 answers