0

I have one of my own custom projects that is an API. What I want to do with it is use it with another one of my projects, however I don't have a maven repository for it, so I cannot add it to the pom.xml for anyone to build

What do I need to do?

Thanks

Elliott
  • 17
  • 2
  • http://stackoverflow.com/questions/2229757/maven-add-a-dependency-to-a-jar-by-relative-path please check this – Jos Mar 12 '16 at 13:51
  • Why not just have the other project call your custom project through its API? – AbuMariam Mar 12 '16 at 13:54
  • I think we are talking about a Java API, not a networked API (but even for that, you probably want to link against a client library). – Thilo Mar 12 '16 at 13:55

2 Answers2

1

I would modify the API project to be built as a Maven project, then run a Maven install against it, this should push it into your local repository and you should be able to use it from the Maven project like any other.

If your company also has a repository that it stores its own code too, something like Nexus, you would do a Maven Release and this would push it to that repository.

Gavin
  • 1,725
  • 21
  • 34
  • 1
    Yes, "mvn install" is the best way. No weird setup at the consuming projects necessary. – Thilo Mar 12 '16 at 13:54
0

I've also found file system based repositories useful in situations like this. You don't need to be running Nexus or Artifactory or anything you just need to make sure all users have access to a shared drive.

As an example:

<repositories>
   <repository>
   <id>local-files</id>
   <name>local-files</name>
   <url>file://S:\filerepo</url>
  </repository> 
<repositories>
JJF
  • 2,681
  • 2
  • 18
  • 31