如果jar已包含在项目中,如何定义maven依赖项

时间:2017-07-18 07:04:20

标签: maven

Maven依赖关系创建如下:

<dependency>
  <groupId>group_id</groupId>
  <artifactId>artificat_id</artifactId>
  <version>2.5.0</version>
</dependency>

相关jar存储在路径project_folder_test/modules/api/repo/com/common/2.5.0

运行命令mvn clean compile后,得到以下错误

Downloading: file:///Users/Automation/project_folder_test/modules/api/repo/com/common/2.5.0/common-2.5.0.pom
Downloading: https://repo.maven.apache.org/maven2/com/common/2.5.0/common-2.5.0.pom
[WARNING] The POM for group_id:artificat_id:jar:2.5.0 is missing, no dependency information available

请让我知道,这出了什么问题。

1 个答案:

答案 0 :(得分:1)

将jar部署到位置文件系统:

mvn deploy:deploy-file -Durl=file:///path/to/yourproject/repo/ -Dfile=mylib-1.0.jar -DgroupId=com.example -DartifactId=mylib -Dpackaging=jar -Dversion=1.0

将存储库部分添加到您的pom:

<repositories>
    <repository>
        <id>project.local</id>
        <name>project</name>
        <url>file:${project.basedir}/repo</url>
    </repository>
</repositories>

请参阅https://devcenter.heroku.com/articles/local-maven-dependencies