如何从maven-dependency-plugin的输出目录中删除版本:unpack?

时间:2011-11-18 15:03:46

标签: maven-2 maven maven-dependency-plugin

我需要解压缩一个工件,我需要在几个地方(多个文件中)使用它的解压缩位置。我不想每次更改版本时都要更新该位置的所有副本。有没有办法可以从输出目录中删除版本?它看起来不像解包mojo支持stripVersion。

2 个答案:

答案 0 :(得分:0)

您用于创建工件的插件是否提供xyzName属性?例如,jar-plugin提供finalNamewar-plugin提供warName

如果是这样,您可以将属性设置为某个固定值。

答案 1 :(得分:-1)

试试这个:

<properties>
    <extracted-artifact-location>${project.build.directory}/extracted-artifact</extracted-artifact-location>
</properties>
...
<build>
    <plugins>
        <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.3</version>
            <executions>
                <execution>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>unpack</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId><fixme></groupId>
                                <artifactId><fixme></artifactId>
                                <version><fixme></version>
                                <outputDirectory>${extracted-artifact-location}</outputDirectory>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>