Maven找不到本地安装的包



我正试图在我的项目中使用第三方jar(特别是Z3(。第三部分jar不是用mvn构建的,所以我使用以下命令添加它:

mvn install:install-file                                                                           
-Dfile="$z3_build_dir"/com.microsoft.z3.jar                                                    
-DgroupId=com.microsoft                                                                        
-DartifactId=z3                                                                                
-Dversion=1.0.0                                                                                
-Dpackaging=jar                                                                                
-DgeneratePom=true                                                                              

我在项目的pom文件中添加了一个依赖项:

<dependency>
<groupId>org.microsoft</groupId>
<artifactId>z3</artifactId>
<version>1.0.0</version>
</dependency>

我可以在这里看到安装的文件~/.m2/repository/com/microsoft/z3/1.0.0/z3-1.0.0.pom

然而,我看到了这个警告和错误:

Downloading from central: https://repo.maven.apache.org/maven2/org/microsoft/z3/1.0.0/z3-1.0.0.pom
Downloading from other-repo: https://other-repo/repository/internal/org/microsoft/z3/1.0.0/z3-1.0.0.pom
[WARNING] The POM for org.microsoft:z3:jar:1.0.0 is missing, no dependency information available
Downloading from central: https://repo.maven.apache.org/maven2/org/microsoft/z3/1.0.0/z3-1.0.0.jar
Downloading from other-repo: https://other-repo/repository/internal/org/microsoft/z3/1.0.0/z3-1.0.0.jar
...
[ERROR] Failed to execute goal on project java-backend: Could not resolve [redacted] Could not find artifact org.microsoft:z3:jar:1.0.0 in central (https://repo.maven.apache.org/maven2) -> [Help 1]

Maven文档说,我不需要做任何额外的事情来查找本地安装的软件包,所以我不明白它为什么要搜索Central。

groupId必须匹配。更改

<groupId>org.microsoft</groupId>

<groupId>com.microsoft</groupId>

就像你在这里指定的:

mvn install:install-file                                                                           
-Dfile="$z3_build_dir"/com.microsoft.z3.jar                                                    
-DgroupId=com.microsoft                                                                        
-DartifactId=z3                                                                                
-Dversion=1.0.0                                                                                
-Dpackaging=jar                                                                                
-DgeneratePom=true*   

pom条目错误。它应该是(基于您的安装命令(

<dependency>
<groupId>com.microsoft</groupId>
<artifactId>z3</artifactId>
<version>1.0.0</version>
</dependency>

最新更新