[英]How to include remote jar dependency in Maven
I need to include a third party jar to my pom.xml (using Maven 3.2.5 on a Linux environment). 我需要在我的pom.xml中包含第三方jar(在Linux环境中使用Maven 3.2.5)。
If the jar file is available on the same machine that runs the build I can just declare the dependency in this way: 如果jar文件在运行构建的同一台机器上可用,我可以用这种方式声明依赖项:
<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>
But what if the jar is on a different server such as 但是如果jar在不同的服务器上怎么办呢
<repositories>
<repository>
<id>myrepo</id>
<url>http://192.168.0.14/download/java/thirdparty_repo</url>
</repository>
</repositories>
In what element should I specify the name of the jar file? 我应该在什么元素中指定jar文件的名称?
Remove 去掉
<scope>system</scope>
<systemPath>/myspace/javalibs/foo-1.0.jar</systemPath>
from pom and Maven will find the jar in http://192.168.0.14/download/java/maven_repo automatically 从pom和Maven将自动找到http://192.168.0.14/download/java/maven_repo中的jar
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.