如何将“maven unpack-dependencies”转换为绝对路径?

时间:2013-04-26 15:48:24

标签: maven maven-dependency-plugin

如何使用maven依赖插件,unpack-dependecies目标解压缩到绝对路径,即在项目树中生成的目标文件夹中不相对?例如,我想在/ 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>

1 个答案:

答案 0 :(得分:6)

检查大小写。它应该是:

<outputDirectory>/usr/local</outputDirectory>