简体   繁体   English

Maven 添加外部 jar

[英]Maven add external jar

I would like to add the following jar我想添加以下 jar

gson-extras-1.0-SNAPSHOT.jar gson-extras-1.0-SNAPSHOT.jar

the jar structure is the following jar结构如下

在此处输入图像描述

looking at the manifest the version is查看清单版本是

Manifest-Version: 1.0清单版本:1.0

the pom is the following pom如下

<repositories>
        <repository>
            <id>grupoicarep</id>
            <url>file:///C:/stix/stix_ica/stix2/lib/</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>com.google.gson</groupId>
            <artifactId>typeadapters</artifactId>
            <version>0.1</version>
        </dependency>
    

but it shows the following error:但它显示以下错误:

Failed to execute goal on project stix2: Could not resolve dependencies for project es.grupoica:stix2:jar:0.0.1-SNAPSHOT: Failure to find com.google.gson:typeadapters:jar:0.1 in file:///C:/stix/stix_ica/stix2/lib/ was cached in the local repository, resolution will not be reattempted until the update interval of grupoicarep has elapsed or updates are forced -> [Help 1] [ERROR]无法在项目 stix2 上执行目标:无法解析项目 es.grupoica:stix2:jar:0.0.1-SNAPSHOT 的依赖项:无法在 file:///C 中找到 com.google.gson:typeadapters:jar:0.1: /stix/stix_ica/stix2/lib/ 已缓存在本地存储库中,在 grupoicarep 的更新间隔结束或强制更新之前不会重新尝试解析 -> [帮助 1] [错误]

I have tried many combinations but I am just guessing and not getting the right result我尝试了很多组合,但我只是在猜测,并没有得到正确的结果

I don´t know what I am doing wrong我不知道我做错了什么

many thanks in advance提前谢谢了

Ana安娜

Use below dependency to include the jar available in the local machine to maven.使用以下依赖项将本地计算机中可用的 jar 包含到 maven。

<dependency>    
  <groupId>groupid</groupId>    
  <artifactId>artifactid</artifactId>   
  <version>1.0</version>    
  <scope>system</scope> 
  <systemPath>${basedir}\lib\JAR_NAME.jar</systemPath>  
</dependency>

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

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