如何在pom.xml中下载和重命名依赖项jar

时间:2014-01-15 21:06:57

标签: maven

这是我的pom.xml,它正在下载依赖项jars- jsaf-3.5.jar和mal-1.5.0.jar但是我想从名称中删除版本部分。那就是jsaf.jar和mal.jar请建议如何在pom.xml中重命名这些jar

<build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.8</version>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}</outputDirectory>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>false</overWriteSnapshots>
              <overWriteIfNewer>true</overWriteIfNewer>
              <excludeTransitive>true</excludeTransitive>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>com.qsa.jsaf</groupId>
      <artifactId>jsaf</artifactId>
      <version>3.5</version>
    </dependency>
  </dependencies>
<dependencies>
    <dependency>
      <groupId>javax.mal</groupId>
      <artifactId>mal</artifactId>
      <version>1.5.0</version>
    </dependency>
  </dependencies>   

</project>

1 个答案:

答案 0 :(得分:4)

来自参数

的依赖项的

Strip version

<stripVersion>true</stripVersion>
  

复制期间剥离工件版本

示例配置

<configuration>
    <stripVersion>true</stripVersion>
    <outputDirectory>${project.build.directory}</outputDirectory>
    <overWriteReleases>false</overWriteReleases>
    <overWriteSnapshots>false</overWriteSnapshots>
    <overWriteIfNewer>true</overWriteIfNewer>
    <excludeTransitive>true</excludeTransitive>
</configuration>