I have 2 projects: ProjA and ProjB. ProjB depends on ProjA. What i'm trying to do is simply copy several files from ProjA (which is packaged with assembly plugin) to ProjB (which is just standard jar) in the package phase.
There are two cases - one works, the other doesn't work. But first here are the relevant files:
ProjA pom:
<build>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/distribution.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
ProjA assembly descriptor:
<id>native-libs</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>dir</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.dll</include>
<include>*.so</include>
</includes>
</fileSet>
</fileSets>
ProjB pom:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy native lib</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>someGroupID</groupId>
<artifactId>ProjA</artifactId>
<version>0.1-SNAPSHOT</version>
<type>dir</type>
<classifier>native-libs</classifier>
<outputDirectory>${project.build.directory}/libs</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
In the first case, if i use <packaging>zip</packaging>
in ProjA's assembly descriptor, and then set ProjB's <goal>unpack</goal>
and <packaging>zip</packaging>
, it all works as expected.
In the second case, if i use <packaging>dir</packaging>
and <goal>copy</goal>
, as it is given in the examples, ProjB fails with error: Failed to execute goal ...:copy on project ProjB: Unable to find artifact.: Could not find artifact...
Is this some bug i'm facing or i'm doing something plain wrong? Again, it works if i change packaging to zip and goal to unpack; it fails for packaging dir and goal copy.