如何设置 Spring 和 Maven 环境以进行离线工作? [英] How do I set up Spring and Maven environment for working offline?

查看:74
本文介绍了如何设置 Spring 和 Maven 环境以进行离线工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要设置 Spring 和 Maven 才能离线工作.我正在使用 Spring Tool Suite.除了 M2 env var 之外,我还需要配置哪些环境变量?当我尝试在 pom.xml 中添加依赖项并键入 springframework 时,搜索栏中没有任何内容.我得到核心异常无法计算构建计划插件 org.apache.maven.plugins:m.我知道 STS 使用 Web 服务来定位 jar,那么我如何配置 Spring 和 Maven 以使其脱机工作?谢谢.

I need to set up Spring and Maven for working offline. I am working with Spring Tool Suite.What environment variables do I need to configure besides M2 env var? When I try to add dependencies in pom.xml, and type springframework, nothing comes up in the search bar. I get "Core exception Could not calculate build plan Plugin org.apache.maven.plugins:m. I understand STS uses web services to locate the jars, so how do I configure Spring and Maven to work offline? Thank you.

推荐答案

在离线之前运行以下内容:

Before you go offline run the following:

mvn 依赖:离线

这会将构建项目所需的所有依赖项和插件下载到 ~/.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

mvn install -o

也可以通过在 ~/.m2/settings.xml 文件中设置离线属性来全局配置离线模式:

It's also possible to configure the offline mode globally by setting the offline property in the ~/.m2/settings.xml file:

真实

这篇关于如何设置 Spring 和 Maven 环境以进行离线工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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