无法解决与maven的依赖关系

发布于 2024-12-09 07:49:48 字数 1937 浏览 1 评论 0 原文

我似乎无法对 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,如果可能的话?

I can't seem to do anything with maven because it can't download its dependencies. When I try to run a sample application from http://openejb.apache.org/ejb3-tutorial.html it gives me some errors:

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

Why can't I download the repositories?

UPDATE: never mind. My boss told me I can't do it because of proxy setting of the company. Anyway, I just want to study ejb the fastest way without using maven if possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

朮生 2024-12-16 07:49:48

看一下 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

太阳哥哥 2024-12-16 07:49:48

您似乎遇到了主机名查找问题:未知主机 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.

煮酒 2024-12-16 07:49:48

在 settings.xml 中添加以下内容对我有用

<profiles>
    <profile>
            <id>outsideMyWorld</id>
            <repositories>
        <repository>
                <id>central</id>
                <url>http://repo1.maven.org/maven2</url>
                <snapshots>
            <enabled>false</enabled>
                </snapshots>
                <releases>
            <enabled>true</enabled>
                </releases>
        </repository>
            </repositories>
    </profile>
</profiles>

<activeProfiles>
        <activeProfile>outsideMyWorld</activeProfile>
</activeProfiles>

Adding following in settings.xml worked for me

<profiles>
    <profile>
            <id>outsideMyWorld</id>
            <repositories>
        <repository>
                <id>central</id>
                <url>http://repo1.maven.org/maven2</url>
                <snapshots>
            <enabled>false</enabled>
                </snapshots>
                <releases>
            <enabled>true</enabled>
                </releases>
        </repository>
            </repositories>
    </profile>
</profiles>

<activeProfiles>
        <activeProfile>outsideMyWorld</activeProfile>
</activeProfiles>
你怎么这么可爱啊 2024-12-16 07:49:48

如果您不允许进行代理配置(安全问题),也许您可​​以说服您的老板和网络管理员在某些开发服务器中设置本地 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

玩物 2024-12-16 07:49:48

我也花了几周的时间来解决这个问题...这就是我解决的方法...

在您的 settings.xml (在 Maven_HOME\conf 目录 下)

我添加了代理条目如下,

<proxies>
    <proxy>
        <active>true</active>
        <protocol>http</protocol>
        <host>IPAddressOfYourGateway</host>
        <port>8080</port>
        <username>YourNetworkUserName</username>
        <password>YourNetworkPassword</password>
        <nonProxyHosts>LocalIPAddress1|LocalIPAddress2|LocalIPAddress3</nonProxyHosts>
     </proxy>
 </proxies>

其中,

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 (under Maven_HOME\conf directory)

I added proxy entry as below

<proxies>
    <proxy>
        <active>true</active>
        <protocol>http</protocol>
        <host>IPAddressOfYourGateway</host>
        <port>8080</port>
        <username>YourNetworkUserName</username>
        <password>YourNetworkPassword</password>
        <nonProxyHosts>LocalIPAddress1|LocalIPAddress2|LocalIPAddress3</nonProxyHosts>
     </proxy>
 </proxies>

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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文