1

我在 pom.xml 文件中有以下依赖项,

    <dependencies>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

我想将那些下载的 jar 文件保存到我指定的目录中。确切的方法是什么?

4

1 回答 1

2

在构建 POM 部分试试这个:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.1</version>
    <executions>
        <execution>
            <id>copy</id>
            <phase>process-resources</phase>
            <goals>
                <goal>copy</goal>
            </goals>
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>[your.dep.group.id]</groupId>
                        <artifactId>[your.dep.artifact.id]</artifactId>
                        <version>[your.dep.version]</version>
                        <type>jar</type>
                        <overWrite>true</overWrite>
                        <outputDirectory>[your.output.dir]</outputDirectory>
                    </artifactItem>
                </artifactItems>
            </configuration>
        </execution>
    </executions>
</plugin>
于 2012-07-10T08:52:38.897 回答