0

I have a library AXMLPrinter2.jar located at generic-local/corey/AXMLPrinter2/1.0/ on my private maven repository, here is the pom file:

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>corey</groupId>
  <artifactId>AXMLPrinter2</artifactId>
  <version>1.0</version>
  <packaging>jar</packaging>
</project>

When I tried to add it as a dependency in my project:

<dependency>
  <groupId>corey</groupId>
  <artifactId>AXMLPrinter2</artifactId>
  <version>1.0</version>
</dependency>

It will cause an error like this:

Could not resolve dependencies for project: The following artifacts could not be resolved: corey:AXMLPrinter2:jar:1.0 Could not find artifact corey:AXMLPrinter2:jar:1.0 in central (http://myip:8081/artifactory/generic-local)

From the log, it tried to find AXMLPrinter2-1.0.jar, but the library's name is AXMLPrinter2.jar (without -1.0) actually, how can I solve this issue?
I found some similar issues here and here, but didn't work.

How to include a dependency and specify its real name in pom file?

Corey
  • 1,217
  • 3
  • 22
  • 39
  • 1
    How did it get into the maven repository in the first place? Did you copy it by hand? If you want to read it from a Maven repository it has to have the right name, i.e. including the version number. – J Fabian Meier Jun 16 '20 at 10:55
  • I got it from my co-worker, and I put it into our own maven repo, I don't know how to deal with this problem (a library without version number), any idea? – Corey Jun 16 '20 at 23:37
  • Seems the only thing I can do is rename the library name to `xxx-1.0.jar`. – Corey Jun 17 '20 at 00:34

1 Answers1

0

checkout the version of the jar in the META-INF folder and inject it in the pom file.

Ashish Karn
  • 1,127
  • 1
  • 9
  • 20
  • 1
    In the META-INF folder, it has a file `MANIFEST.MF`, it shows `Manifest-Version: 1.0 Main-Class: test.AXMLPrinter`, how to inject into my pom file? any example? – Corey Jun 16 '20 at 10:30
  • 1
    Its version is 1.0 and you added dependency correctly. I think the problem might at linking of jar and maven. Please check and try https://stackoverflow.com/questions/5692256/maven-best-way-of-linking-custom-external-jar-to-my-project – Ashish Karn Jun 16 '20 at 11:00
  • Thanks for sharing, but I want to pull the jar from my own maven repo, I don't want to put it in my source control. – Corey Jun 16 '20 at 23:48