简体   繁体   English

手动下载和安装maven插件

[英]Manually downloading and installing maven plugins

I am on proxy network and proxy is preventing maven to connect to central repo 我在代理网络和代理正在阻止maven连接到中央仓库

Is there any way to download the maven plugins manually and installing the plugins in local .m2 repo. 有没有办法手动下载maven插件并在本地.m2 repo中安装插件。

Thanks 谢谢

If you have the jar, you can use : 如果你有罐子,你可以使用:

mvn install:install-file -DgroupId=<your_group_name>  \
-DartifactId=<your_artifact_name>  \
-Dversion=<version>  \
-Dfile=<path_to_your_jar_file>  \
-Dpackaging=jar \
-DgeneratePom=true

if you don't have it, and it's not a private arrtifact, you can find the jar and the informations in repository website (for exemple http://mvnrepository.com/ ) 如果您没有它,并且它不是私有的arrtifact,您可以在存储库网站中找到jar和信息(例如http://mvnrepository.com/

Have a look here if you want to configure a proxy for maven. 如果要为maven配置代理,请查看此处。 That way you do not need to download the dependencies in any obscure and unreliable way: Howto configure a proxy for Maven 这样您就不需要以任何模糊和不可靠的方式下载依赖项: 如何为Maven配置代理

The simplest way to do this is to use any machine that can connect to central to download all repo you need then copy ./m2 manually to your machine with usage of offline flag every build 最简单的方法是使用任何可以连接到中央的机器下载所需的所有仓库,然后手动将./m2复制到您的机器上,每次构建都使用离线标志

if your solution is scalable you will need to install nexus or any maven repository on machine can goes outside and you configure maven to see repo machine. 如果您的解决方案是可扩展的,您将需要安装nexus或机器上的任何maven存储库都可以到外面并且您配置maven以查看repo机器。 and this is the model solution to that case 这是该案例的模型解决方案

To install a jar you can use install:install-file to install any kind of jar. 要安装jar,您可以使用install:install-file来安装任何类型的jar。 But a maven plugin comes with dependencies so you will have to install them. 但maven插件带有依赖项,因此您必须安装它们。 My suggestion would be to copy a .m2 repo from a machine with access to the internet (for maven). 我的建议是从一台可以访问互联网的机器上复制.m2回购(对于maven)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM