可以在第一次Maven构建脱机做? [英] could the first ever maven build be made offline?

查看:188
本文介绍了可以在第一次Maven构建脱机做?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是:你有一个压缩的java项目分布,这取决于几个库如春芯,弹簧的背景下,jacskon,TestNG的和SLF4J。任务是使事情可建下线。没关系创建项目范围的本地回购了所有所需的库JAR文件。

The problem: you have a zipped java project distribution, which depends on several libraries like spring-core, spring-context, jacskon, testng and slf4j. The task is to make the thing buildable offline. It's okay to create project-scope local repo with all required library jars.

我试图做到这一点。看起来即使项目中包含它需要的javac和运行时的罐子,构建仍然需要上网。 Maven的仍然潜伏到网络获得最自己的插件它需要构建。我认为Maven是空目录的.m2运行(因为这可能是最早推出的版本,这可能是一个离线构建)。不,我不好啦沿项目本身散发充满行家回购的快照,因为这看起来像一个完全混乱了我。

I've tried to do that. Looks like even as the project contains the jars it requires for javac and runtime, the build would still require internet access. Maven would still lurk into network to fetch most of its own plugins it requires for the build. I assume that maven is run with empty .m2 directory (as this may be the first launch of the build, which may be an offline build). No, I am not okay with distributing full maven repo snapshot along the project itself, as this looks like an utter mess for me.

底色​​的有点:更广泛的任务是创建窗户沿项目进展,并允许一些最起码的Java编码/ IDE内以最低的配置和最小的上网运行的便携式式JDK / IntelliJ IDEA的分布。该项目是在计算机课对学生有针对性,有超过系统配置很少或根本没有控制权。它希望保持控制台构建系统完整的离线模式,但我想这Maven是过度依赖网络,所以我必须要抛弃它有利于良好的老蚂蚁。

A bit of backround: the broader task is to create windows portable-style JDK/IntelliJ Idea distribution which goes along the project and allows for some minimal java coding/running inside IDE with minimal configuration and minimal internet access. The project is targeted towards students in a computer class, with little or no control over system configuration. It is desirable to keep console build system intact for the offline mode, but I guess that maven is overly dependent on the network, so I have to ditch it in favor of good old ant.

那么,什么是你的意见,我们可以先移动行家在离线模式下建立完全?我的直觉是,初次分配的Maven只包含拉必不可少的插件关闭主回购所需的最低限度,并没有充分发挥作用,而不会看到主回购至少一次。

So, what's your opinion, could we move first maven build in offline mode completely? My gut feeling is that initial maven distribution just contains the bare minimum required to pull essential plugins off the main repo and is not fully functional without seeing the main repo at least once.

推荐答案

Maven有一个-o开关,它允许你建立离线:

Maven has a '-o' switch which allows you to build offline:

 -o,--offline                           Work offline

当然,你需要有你已经被缓存到您的 $ HOME / .m2目录/库该建没有错误的依赖关系。您可以装载相关性:

Of course, you will need to have your dependencies already cached into your $HOME/.m2/repository for this to build without errors. You can load the dependencies with:

mvn dependency:go-offline

我想这个过程中,它似乎并没有完全工作。我做了:

I tried this process and it doesn't seem to fully work. I did a:

rm -rf $HOME/.m2/repository
mvn dependency:go-offline       # lot of stuff downloaded
# unplugged my network
# develop stuff
mvn install                     # errors from missing plugins

什么确实的工作,但是是:

rm -rf $HOME/.m2/repository
mvn install                     # while still online
# unplugged my network
# develop stuff
mvn install

这篇关于可以在第一次Maven构建脱机做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆