简体   繁体   English

如何在我的本地repo Maven中下载并安装jar

[英]how to download and install jar in my local repo 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. 我正在尝试下载一个内部仓库的jar,我已经在tomcat下,然后将其安装到我当地的maven仓库。

the jar file can be found under the path:http://10.11.250.14/strepo/ext/JSErrorCollector-0.2.jar jar文件可以在以下路径中找到:http://10.11.250.14/strepo/ext/JSErrorCollector-0.2.jar

i edit my pom.xml providing the link of the internal repo and also add a dependency in the pom but the maven cannot downloaded thre jar. 我编辑我的pom.xml提供内部repo的链接,并在pom中添加依赖,但maven无法下载thre 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? 你能帮助我吗?

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. 它不仅仅是制作Maven存储库的jar,还有许多其他东西需要被视为Maven存储库。 From the URL I think it is not a standard Maven repository layout. 从URL我认为它不是标准的Maven存储库布局。

So you have at least 2 options: 所以你至少有两个选择:

  1. Setup your own local network Maven repository, either using Artifactory , Nexus or other similar software systems. 使用ArtifactoryNexus或其他类似的软件系统设置您自己的本地网络Maven存储库。
  2. Download the file and add it to your local machine repository. 下载文件并将其添加到本地计算机存储库。

For option 2, just download the file, and then run the Maven mvn command as follow (assuming the file is at your current directory): 对于选项2,只需下载该文件,然后运行Maven mvn命令,如下所示(假设该文件位于当前目录中):

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM