Maven本地存储库 [英] Maven local repository
问题描述
我希望Maven可以离线工作.我将春季和冬眠之类的所有工件下载到了计算机上.然后,我尝试将Maven设置为仅使用本地存储库.我按照说明将Maven指向本地存储库.但是,每次我尝试加载spring mvc项目时,都会出现如下错误:
I want Maven to work offline. I downloaded all artifacts like spring and hibernate onto my computer. Then I tried to set up Maven to use local repository only. I followed instructions to point Maven to local repository. However every time I tried to load spring mvc project, I got the errors like this:
离线/缺少工件org.springframework:spring-context:jar:3.0.6.RELEASE:compile 离线/缺少工件org.springframework:spring-core:jar:3.0.6.RELEASE:compile
Offline / Missing artifact org.springframework:spring-context:jar:3.0.6.RELEASE:compile Offline / Missing artifact org.springframework:spring-core:jar:3.0.6.RELEASE:compile
我检查了本地存储库. jar和pom文件在那里.我无法弄清楚我的配置出了什么问题.有人可以帮我吗?
I checked the local repository. The jar and pom files are there. I can't figure out what is wrong with my configuration. Can someone help me out here?
谢谢.
杰里
推荐答案
您可能弄乱了settings.xml.
You probably messed up your settings.xml.
准备离线的正确方法是:
Correct way to prepare for offline is this:
mvn install dependency:go-offline
bilash.saha给出的答案不适用于多模块项目.
The answer bilash.saha gave will not work for multi module projects.
第一个命令完成后,您可以通过运行来测试一切正常
After first command finished, you may test that everything is ok by running
mvn -o package
要避免每次输入"-o",请使用以下settings.xml:
To save you a from typing "-o" every time use this settings.xml:
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<offline>true</offline>
</settings>
这篇关于Maven本地存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!