开发者

How to create local Maven repository for hosting non-Mavenized libraries?

开发者 https://www.devze.com 2023-02-28 16:18 出处:网络
Here\'s the problem: I love using Maven, as it completely simplifies development and dependency management. However, I\'m wo开发者_JAVA技巧rking with a server which isn\'t Mavenized, so I can\'t just

Here's the problem: I love using Maven, as it completely simplifies development and dependency management. However, I'm wo开发者_JAVA技巧rking with a server which isn't Mavenized, so I can't just add it as a provided dependency. Is there a way to simply specify an additional library folder and add it to the Java compiler classpath, or would I need to actually create an entire local Maven repository for this? I know it completely limits my portability, but I'm okay with that. Thoughts? Also, after compiling, I'll need to copy all of my non-provided dependencies to the local server lib directory, I assume I can use the copy-dependencies plugin to move everything over.


Download Nexus for free from Sonatype, or Artifactory, or any of the other repository managers.

The alternative is to learn about install:install-file to shove jars into your personal local repo. However, having a full repo as above has so many advantages (not the least speed via caching) that it's easier to just install one.


You can use a Maven2 repository implementation such as Nexus, Artifactory, or Archiva.

You can create a simple POM for the non-maven dependency you are working with and use the deploy:deploy-file goal to deploy it to the repository.

If you just need the dependency locally you can use the install:install-file to install the dependency in your local repository. This approach requires nothing more than maven be installed on your machine.

If you just want to add libraries to the path of your build without worrying about repositories you can declare them as system dependencies. I do not recommend this approach but it should work fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消