我有一个我的项目依赖的jar,但是该库中还包含一个实用程序,但是为了使该实用程序正常工作,我需要主JAR依赖的所有依赖项。
[库的创建者为其提供了jar-with-dependencies.jar文件,该文件也在中央Maven存储库中。
但是,当我仅指定groupId / artifactId / version时,我在.m2/repository
目录中看到的只是主jar,而不是主jar-with-dependencies.jar
。
如何自动下载该库的jar-with-dependencies.jar
?当我在pom.xml
中将该库指定为依赖项时,是否要指定一些特殊内容?
如果要添加的依赖项遵循标准的Maven命名约定,则在声明依赖项时可以使用分类器选项。下面是一个例子。
<dependency>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
<version>1.0.0</version>
<classifier>jar-with-dependencies</classifier>
</dependency>