如何在Maven中包含远程jar依赖项 [英] How to include remote jar dependency in Maven
本文介绍了如何在Maven中包含远程jar依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在我的pom.xml中包含一个第三方jar(在Linux环境中使用Maven 3.2.5).
I need to include a third party jar to my pom.xml (using Maven 3.2.5 on a Linux environment).
如果jar文件在运行该版本的同一台计算机上可用,我可以通过这种方式声明依赖项:
If the jar file is available on the same machine that runs the build I can just declare the dependency in this way:
<dependencies>
<dependency>
<groupId>Foo</groupId>
<artifactId>Foo</artifactId>
<version>Foo-1.0</version>
<scope>system</scope>
<systemPath>/myspace/javalibs/foo-1.0.jar</systemPath>
</dependency>
</dependencies>
但是,如果jar位于其他服务器上,例如
But what if the jar is on a different server such as
<repositories>
<repository>
<id>myrepo</id>
<url>http://192.168.0.14/download/java/thirdparty_repo</url>
</repository>
</repositories>
我应在哪个元素中指定jar文件的名称?
In what element should I specify the name of the jar file?
推荐答案
删除
<scope>system</scope>
<systemPath>/myspace/javalibs/foo-1.0.jar</systemPath>
从pom和Maven可以在 http://192.168.0.14/download/java/maven_repo中找到该jar. 自动
from pom and Maven will find the jar in http://192.168.0.14/download/java/maven_repo automatically
这篇关于如何在Maven中包含远程jar依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文