nishantjr
nishantjr

Reputation: 1830

Maven does not find locally installed package

I'm trying to use a third party jar in my project (Z3 specifically). The third part jar is not built with mvn, so I add it using this command:

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                                                                              

I've added a dependency to my project's pom file:

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

I can see the installed file here ~/.m2/repository/com/microsoft/z3/1.0.0/z3-1.0.0.pom.

However, I'm seeing this warnings and error:

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]

The Maven documentation says I need to do nothing extra to find locally installed packages, so I don't understand why it's searching Central.

Upvotes: 0

Views: 319

Answers (2)

Debopam
Debopam

Reputation: 3356

pom entry is wrong. It should be (based on your install command)

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

Upvotes: 2

Elliott Frisch
Elliott Frisch

Reputation: 201537

The groupId has to match. Change

<groupId>org.microsoft</groupId>

to

<groupId>com.microsoft</groupId>

like you specified here:

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*   

Upvotes: 4

Related Questions