I have jar files that cannot be found on Maven Central repository. I would like to add the jar so I can just include extra tag in my pom.xml file and other developer can use the jar. What are the steps needed to upload the jar to http webserver webfolder? What file should I uploaded beside custom.jar? What other files need to exist on the webfolder side by side with custom.jar?
I have jar files that cannot be found on Maven Central repository. I would
Share
If you already have a web server set up pointing on a web folder, a simple way to deploy your custom JAR would to use the
deploy:deploy-fileMojo. As documented in the Usage page of the Maven Deploy Plugin:Only the 3 first parameters are mandatory (short version). If you wonder what the repositoryId is, the documentation of the Mojo says:
In other words, the simplest way to use this would be to copy your custom JAR on the machine hosting the web server and to use the
file://protocol when specifying the URL. There is no additional setup required. If you want to deploy remotely, thenscp://is often the preferred protocol (there are others but this one is pretty easy to setup). Below, an example using scp:Actually, using a web server to host your own Maven repository is perfectly fine but it can be a bit painful to initialize. One solution to solve this issue is to use a Maven proxy (like Nexus for example) instead of just a Maven repository. But this goes beyond your question.
For more resources on this, check (the principles are still valid even if the implementation solutions are a bit outdated):