简体   繁体   English

Spring项目如何离线运行?

[英]How to run spring project offline mode?

I am trying to run a Spring Project, with several dependencies, that I have already downloaded into my local repository, and have also done followings : 我正在尝试运行一个具有多个依赖项的Spring项目,该项目已经下载到本地存储库中,并且还执行以下操作:

  1. Added local repository path in setting.xml in localRepository tag. 在localRepository标记的setting.xml中添加了本地存储库路径。
  2. Running the project using mvn install -nsu -llr -o , for offline mode. 使用mvn install -nsu -llr -o运行项目,以脱机模式运行。

And I am getting following error : 而且我得到以下错误:

[ERROR] Failed to execute goal on project file2Json: Could not resolve dependencies for project com.nse.file2Json:file2Json:jar:0.0.1-SNAPSHOT: Cannot access central ( http://repo1.maven.org/maven2 ) in offline mode and the artifact com.fasterxml.jackson.dataformat:jackson-dataformat-csv:jar:2.8.4 has not been downloaded from it before. [错误]无法在项目file2Json上执行目标:无法解析项目com.nse.file2Json:file2Json:jar:0.0.1-SNAPSHOT的依赖项:无法在以下位置访问中央( http://repo1.maven.org/maven2 )脱机模式,并且以前从未从其下载工件com.fasterxml.jackson.dataformat:jackson-dataformat-csv:jar:2.8.4。 -> [Help 1] -> [帮助1]

I have the dependency installed, take a look :( 我已经安装了依赖项,看看:( 在此处输入图片说明

I have following questions : 我有以下问题:

  1. Why is the project is trying to look into http://repo1.maven.org/maven2 when I am using offline mode ? 当我使用脱机模式时,为什么项目要尝试查看http://repo1.maven.org/maven2
  2. How can I run the project offline, by providing the required dependencies at required paths ? 如何通过在所需路径上提供所需的依赖项来离线运行项目? Please help ! 请帮忙 ! thanks in advance. 提前致谢。

It says it cannot access Maven Central because you are in offline mode. 它说它不能访问Maven Central,因为您处于离线模式。 And it tries to look there, because ´jackson-dataformat-csv` is not in your local repository, so Maven needs to get it from somewhere (and Maven Central is the default repository). 它会尝试查找,因为“ jackson-dataformat-csv”不在您的本地存储库中,因此Maven需要从某个地方获取它(Maven Central是默认存储库)。

What you need to do is to execute mvn dependency:go-offline before you switch to the offline mode. 您需要做的是在切换到离线模式前执行mvn dependency:go-offline This will download everything that you need (dependencies, transitive dependencies as well as plugins). 这将下载您需要的所有内容(依赖项,传递性依赖项以及插件)。

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

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