如何在我的本地仓库Maven中下载并安装jar [英] how to download and install jar in my local repo Maven
问题描述
我正在尝试使用tomcat下的一个内部回购下载一个jar,然后将其安装到本地maven回购中.
I am trying to download a jar for an internal repo with I have under tomcat and then install it to my local maven repo.
可以在path:http://10.11.250.14/strepo/ext/JSErrorCollector-0.2.jar
下找到jar文件.
The jar file can be found under the path:http://10.11.250.14/strepo/ext/JSErrorCollector-0.2.jar
.
我编辑我的pom.xml
,提供内部仓库的链接,并在pom.xml
中添加依赖项,但行家无法下载jar.
I edit my pom.xml
providing the link of the internal repo and also add a dependency in the pom.xml
but the maven cannot download the jar.
<repositories>
<repository>
<id>internal.repo</id>
<url>http://10.11.250.14/strepo/ext/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.JS</groupId>
<artifactId>JSErrorCollector</artifactId>
<version>0.2</version>
</dependency>
你能不能请任何人帮助我?
Could you please anyone help me?
推荐答案
不仅仅是制作Maven存储库的罐子,还有很多其他东西需要被视为Maven存储库.从URL来看,我认为这不是标准的Maven存储库布局.
It's not just the jar only to make a Maven repository, there are a bunch of other stuffs required to be regarded as Maven repository. From the URL I think it is not a standard Maven repository layout.
因此,您至少有2个选择:
So you have at least 2 options:
- 使用 Artifactory ,
- Setup your own local network Maven repository, either using Artifactory, Nexus or other similar software systems.
- Download the file and add it to your local machine repository.
对于选项2,只需下载文件,然后按如下所示运行Maven mvn命令(假设文件位于当前目录中):
For option 2, just download the file, and then run the Maven mvn command as follow (assuming the file is at your current directory):
mvn install:install-file -Dfile=JSErrorCollector-0.2.jar -DgroupId=strepo.ext -DartifactId=JSErrorCollector -Dversion=0.2 -Dpackaging=jar
之后,您可以使用以下内容进行引用:
After that you can refer to that using:
<dependency>
<groupId>strepo.ext</groupId>
<artifactId>JSErrorCollector</artifactId>
<version>0.2</version>
</dependency>
这篇关于如何在我的本地仓库Maven中下载并安装jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!