使用maven指定特定的jar文件

时间:2015-01-16 17:26:21

标签: java maven

在〜/ .m2 / path / to / jarfiles中有jar文件。一个是dependencyName.jar,另一个是dependencyName-runtime.jar我试图使用maven-dependency-plugin来复制jar的运行时版本,但它不断复制jar的常规版本。

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>${maven.dependency.version}</version>
            <executions>
                <execution>
                    <id>copy</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>org.jacoco</groupId>
                                <artifactId>org.jacoco.agent</artifactId>
                                <version>${code.coverage.jacoco.version}</version>
                                <type>jar</type>
                                <overWrite>false</overWrite>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>

1 个答案:

答案 0 :(得分:1)

假设runtime是分类器,您应该添加

<classifier>runtime</classifier>

artifactItem