1

如何使用 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>
4

1 回答 1

6

检查大小写。它应该是:

<outputDirectory>/usr/local</outputDirectory>
于 2013-04-26T16:55:26.923 回答