无法解决与maven的依赖关系
我似乎无法对 Maven 执行任何操作,因为它无法下载其依赖项。当我尝试从 http://openejb.apache.org/ejb3-tutorial 运行示例应用程序时。 html 它给了我一些错误:
D:\apache-maven-3.0.3\openejbsamples\simple-stateless>mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building OpenEJB :: Examples :: Simple Stateless Pojo 1.0
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.454s
[INFO] Finished at: Thu Oct 13 11:47:26 CST 2011
[INFO] Final Memory: 1M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.ap
ache.maven.plugins:maven-clean-plugin:jar:2.4.1: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to central (http://repo1
.maven.org/maven2): Error transferring file: repo1.maven.org: Unknown host repo1.maven.org -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
为什么我不能下载存储库?
更新:没关系。我的老板告诉我,由于公司的代理设置,我不能这样做。不管怎样,我只是想以最快的方式学习ejb而不使用maven,如果可能的话?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
看一下 Using Proxies With Maven,因为这个问题很可能是由于您拥有“异国情调”的互联网连接而导致。 (防火墙、dns 覆盖、其他代理等...)
如果您确实位于代理后面,并且需要用户名/密码,请查看 cntlm
Take a look at Using Proxies With Maven, as the issue is most likely caused by you having an "exotic" Internet connection. (firewall, dns overwrite, other proxies, etc..)
If you are indeed behind the proxy, and it requires username/password, check out cntlm
您似乎遇到了主机名查找问题:
未知主机 repo1.maven.org
。这是中央 Maven 存储库的正确主机名。检查您的 DNS 设置和/或您可能拥有的任何本地主机名覆盖。当然,如果您使用的是公司 DNS 并且您的互联网访问通常受到限制,那么可能就是这样。It looks like you have a host name lookup problem:
Unknown host repo1.maven.org
. That's the correct host name for the central Maven repository. Check your DNS settings and/or any local host name overrides you might have. Of course, if you're using a corporate DNS and your internet access is generally restricted, that's probably it.在 settings.xml 中添加以下内容对我有用
Adding following in settings.xml worked for me
如果您不允许进行代理配置(安全问题),也许您可以说服您的老板和网络管理员在某些开发服务器中设置本地 Maven 存储库。查看此链接(如果您的代理和网络管理员同意的话..当然:P)http://www.theserverside.com/news/1364121/Setting-Up-a-Maven-Repository
If you are not allowed to have the proxy configuration (security issues), maybe you can convince your boss and the network admin to set up a local maven repository in some dev server. Check out this link (if your proxy and your network admin are ok with it .. of course :P) http://www.theserverside.com/news/1364121/Setting-Up-a-Maven-Repository
我也花了几周的时间来解决这个问题...这就是我解决的方法...
在您的
settings.xml
(在Maven_HOME\conf 目录
下)我添加了代理条目如下,
其中,
1)“IPAddressOfYourGateway”可以从IEExplorer→>中获得。设置->代理.. 这是您代理的 IP 地址..
2) LocalIPAddress1|LocalIPAddress2.. "|" ..管道符号用于添加多个IP地址...需要从代理绕过...
您需要与您的网络团队核实该端口,以防它无法像您的情况一样工作......
I also struggled for weeks to fix this.... This is how I fixed...
In your
settings.xml
(underMaven_HOME\conf directory
)I added proxy entry as below
wherein,
1) "IPAddressOfYourGateway" can be obtained from IEExplorer -> Settings-> Proxy.. this is IP Address of your Proxy..
2) LocalIPAddress1|LocalIPAddress2.. "|" .. the pipe sign is used for adding multiple IP Addresses... that need to be bypassed from proxy...
You need to check with your network team for the port in case it doesn't work as it is in your case...