gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 09:21:26 24 4
gpt4 key购买 nike

这是我的 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>

最佳答案

Strip version来自带参数的依赖

<stripVersion>true</stripVersion>

Strip artifact version during copy

示例配置

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

关于maven - 如何在 pom.xml 中下载和重命名依赖 jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21148205/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com