0

I'd like to add one project A as my dependency, but unfortunately, there's no repository host this library. I know that I can install it to local repository manually, then refer this in pom file. But I have a travis build job where there's no such artifact, is there any way that I can install this library to local repo automatically ? Thanks

zjffdu
  • 25,496
  • 45
  • 109
  • 159
  • 4
    Isn't this a dupe of http://stackoverflow.com/questions/4955635/how-to-add-local-jar-files-in-maven-project – fvu Sep 27 '16 at 00:14
  • Do an install to your local .m2 in a command shell using the mvn command. – duffymo Sep 27 '16 at 00:31

1 Answers1

3

I would recommend to use the clean approach and uploading this library into your own repository. If you don't have one: time to get one running.

If you're really not up to this task the maven install plugin: http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html can install a jar in the local repository. This will work both locally and on a CI server.

To upload a jar in a remote repository there is the deploy plugin: http://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html

If you bind the execution of this plugin to a very early phase in the maven life-cycle (validate) you might be able to avoid a build step required prior of your own build.

wemu
  • 7,952
  • 4
  • 30
  • 59