在maven中创建后解压缩jar内容

时间:2014-05-10 14:12:58

标签: maven

我在我的pom.xml中有这个插件,它创建一个jar文件并放在某个地方:

<plugin>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
        <outputDirectory>${basedir}/../../web/src/main/docroot/WEB-INF/lib</outputDirectory>
    </configuration>
</plugin>

我想在创建它之后将这个jar提取到某个目录中。我怎么能这样做?

1 个答案:

答案 0 :(得分:0)

我找到了这个解决方案,它对我有用::)

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
        <execution>
            <id>unpack</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>unpack</goal>
            </goals>
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>ir.nsdp.satra</groupId>
                        <artifactId>Shapeloader</artifactId>
                        <version>1.0</version>
                        <type>jar</type>
                        <excludes>META-INF/**</excludes>
                        <outputDirectory>${basedir}/../../../web/src/main/docroot/WEB-INF/classes</outputDirectory>
                    </artifactItem>
                </artifactItems>
            </configuration>
        </execution>
    </executions>
</plugin>