Question

How can I use the maven dependency plugin, unpack-dependecies goal to unpack to an absolute path, that is, NOT relative inside the generated target folder in the project tree? For example, I want to unpack the artifacts of the two dependencies below in /usr/local/*

<dependencies>
    <dependency>
        <groupId>package.org.apache.apr</groupId>
        <artifactId>apr-bin</artifactId>
        <version>1.4.6</version>
        <classifier>bin</classifier>
        <type>tar.gz</type>
    </dependency>
    <dependency>
        <groupId>package.org.apache.apr-util</groupId>
        <artifactId>apr-util-bin</artifactId>
        <version>1.4.1</version>
        <classifier>bin</classifier>
        <type>tar.gz</type>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.7</version>
            <executions>
                <!-- Unpack header files and libraries for build -->
                <execution>
                    <id>apr-bin-unpack</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>unpack-dependencies</goal>
                    </goals>
                    <configuration>
                        <excludeTransitive>true</excludeTransitive>
                        <!-- This element does NOT make a difference -->
                        <outputdirectory>/usr/local</outputdirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
Was it helpful?

Solution

Check the capitalization. It should be:

<outputDirectory>/usr/local</outputDirectory>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top