Dan L.
Dan L.

Reputation: 1747

copy dependency assembly resources to specific folder

I have ProjectA which uses the Maven assembly plugin to pack some resources from a module into the repository.

I have then ProjectB which has a dependency on ProjectA. In ProjectB, I'd like to use the maven-dependency-plugin to unpack the module resources(packed by the assembly plugin) into some target folder of my choice.

I configured the dependency plugin as following, but when I run maven, it will only copy the module's resources and not also the assembly resources.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.1</version>
    <executions>
        <execution>
            <phase>initialize</phase>
            <goals>
                <goal>unpack</goal>
            </goals>
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>path.to.projectA.groupId</groupId>
                        <artifactId>moduleA</artifactId>
                        <version>1.0</version>                  

                        <outputDirectory>some/path/here</outputDirectory>
                    </artifactItem>
                </artifactItems>
            </configuration>
        </execution>
    </executions>
</plugin>

Upvotes: 0

Views: 960

Answers (1)

Raghuram
Raghuram

Reputation: 52645

You would need to specify the correct classifier and type to maven so that it can do this. Your assembly should available in your local repository or downloadable from repository.

For instance, assuming your assembly was named moduleA-distribution-1.0.zip, you would alter the above snippet as follows:

             <artifactItem>
                    <groupId>path.to.projectA.groupId</groupId>
                    <artifactId>moduleA</artifactId>
                    <version>1.0</version>                  
                    <classifier>distribution</classifier>
                    <type>zip</type>
                    <outputDirectory>some/path/here</outputDirectory>
              </artifactItem>

Upvotes: 2

Related Questions