简体   繁体   中英

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 :

  1. Added local repository path in setting.xml in localRepository tag.
  2. Running the project using mvn install -nsu -llr -o , for offline mode.

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. -> [Help 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 ?
  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. 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).

What you need to do is to execute mvn dependency:go-offline before you switch to the offline mode. This will download everything that you need (dependencies, transitive dependencies as well as plugins).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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