Maven离线 - mvn-plugins的问题 [英] Maven offline - problem with mvn-plugins
问题描述
我在我的项目中使用maven,我需要在非互联网访问机器中运行构建。
I'm using maven in my project and I need to run the build in a non-internet-access machine.
我测试我的项目构建一切正常,但是当我在未来的时刻运行构建 时,maven尝试更新mvn-plugins 并且此 sh t *正在破坏我的构建。
When I test my project build everything is working, but when I run the build in a future moment, the maven try to update the mvn-plugins and this sht* is broking my build.
我的配置文件:来自mvn的 settings.xml 。
My config file: settings.xml from mvn.
<profile>
<id>blaProfile</id>
<repositories>
<repository>
<id>blaRepo</id>
<url>file://${bla.3rdParty.home}/maven/.m2/repository</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>blaRepo</id>
<url>file://${bla.3rdParty.home}/maven/.m2/repository</url>
<layout>default</layout>
</pluginRepository>
</pluginRepositories>
</profile>
<activeProfiles>
<activeProfile>blaProfile</activeProfile>
</activeProfiles>
我跑了我的maven是用params:
And I ran my maven is with the params:
mvn -npu -bla.3rdParty.home="$(THE_CORRECT_PATH)" package
我看到maven尝试更新一些mvn-plugins一段时间了,但是选项:
I saw that maven try to update some mvn-plugins for some time, but the option:
-npu,--no-plugin-updates Suppress upToDate check for any relevant
应该适用于这个更新。
等待一些帮助!
提前致谢!
更新(1):
我正在看的是,我可以使用以下设置:
Thanks in advance!
UPDATE(1):
What I'm looking at, is that I could use the setting:
<usePluginRegistry>true</usePluginRegistry>
在我的 settings.xml 中,有了这个,我会有一个我可以配置并强制maven插件版本的$ {user.home} /。m2里面的 plugin-registry.xml 。
但它不起作用! :(
Inside my settings.xml and with this, I'll have a plugin-registry.xml inside ${user.home}/.m2 that I can config and force the maven plugins versions.
But it's not working! :(
推荐答案
在您离线之前,请运行以下命令:
Before you go offline run the following:
mvn dependency:go-offline
这会将您构建项目所需的所有依赖项和插件下载到〜/ .m2 / repository。
That will download all your dependencies and plugins that you need to build your project into ~/.m2/repository.
运行后,您现在可以构建使用'-o'标记脱机项目:
Once you've run that you can now build your project offline using the '-o' flag:
mvn install -o
这篇关于Maven离线 - mvn-plugins的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!