【发布时间】:2016-10-16 17:41:17
【问题描述】:
我想知道是否有办法从 maven 依赖项中删除版本号。
假设对于我的项目,我想使用 maven 依赖插件获取 commons-lang3 3.4:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
我的 pom 配置显示,它正在将依赖项获取到我项目中的 ./lib 目录。
我想要实现的是从commons-lang3-3.4.jar 中即时删除版本号。它看起来像:
./lib/commons-lang3.jar
问题:有没有办法做到这一点?
在这里指定 finalName 无济于事。
<build>
<finalName>${project.name}-testing</finalName>
</build>
在我现有的配置下:
<project>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>process-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${dir.javaLibs}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
【问题讨论】:
-
您能分享更多您的
pom.xml配置吗?它们是如何复制到您的lib文件夹中的? -
你在做什么项目?战争/耳朵?有什么不同?
-
这是不同的东西。这是一个“脚本”项目,但我配置为一个 maven 项目来获取流程中使用的 .jar 依赖项。我确实使用了复制依赖目标。请查看我的 pom.xml 文件的一部分:pastebin.com/WBuAcnzw
-
@dejvid 请下次直接(从一开始)将配置添加到您的问题中:这将简化和加速反馈:)
标签: maven maven-3 pom.xml maven-dependency-plugin