使用maven复制依赖项

时间:2015-03-27 16:57:19

标签: maven

我想将依赖项复制到target / lib目录。如何通过maven执行此操作? 我试过这个:

<plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <mainClass>com.aproject.App</mainClass>
                        <classpathPrefix>libs/</classpathPrefix>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.5.1</version>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <includeScope>runtime</includeScope>
                        <outputDirectory>${project.build.directory}/lib/</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>

但它在jar中复制库(我想要目录)。

1 个答案:

答案 0 :(得分:0)

我使用与您上面发布的完全相同,但我使用的是maven-dependency-plugin的2.8版本。您是否尝试过更新插件依赖项?