【问题标题】:How to "maven unpack-dependencies" to an absolute path?如何“maven unpack-dependencies”到绝对路径?
【发布时间】:2013-04-26 15:48:23
【问题描述】:

如何使用 maven 依赖插件 unpack-dependecies 目标解压到绝对路径,即在项目树中生成的目标文件夹中不是相对路径?比如我想在/usr/local/*中解压下面两个依赖的artifact

<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>

【问题讨论】:

  • 你使用的是哪个版本的依赖插件?
  • 由于我没有指定 ,所以默认为最新的,即 2.1。谢谢!
  • 用最新版本2.7再试一次。有什么区别吗?

标签: maven maven-dependency-plugin


【解决方案1】:

检查大小写。应该是:

<outputDirectory>/usr/local</outputDirectory>

【讨论】:

    猜你喜欢
    • 2012-02-01
    • 2014-03-16
    • 2016-07-08
    • 2011-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-16
    • 2014-02-28
    相关资源
    最近更新 更多