简体   繁体   English

Project不会识别任何maven依赖项

[英]Project will not recognize any of maven dependencies

I get the following error when I maven install my Project : 当我maven install我的项目时,我收到以下错误:

Failed to execute goal on project xxx Could not resolve dependencies for project yyy:xxx:1.0: 
Failed to collect dependencies for [log4j:log4j:jar:1.2.9 (compile), junit:junit:jar:3.8.1 (compile), yyy:framework:jar:1.0 (compile), ant:ant:jar:1.6.2 (compile), 
commons-beanutils:commons-beanutils:jar:1.6.1 (compile), commons-collections:commons-collections:jar:3.1 (compile), 
commons-dbcp:commons-dbcp:jar:1.2.1 (compile), commons-digester:commons-digester:jar:1.5 (compile), 
commons-fileupload:commons-fileupload:jar:1.0 (compile), commons-lang:commons-lang:jar:2.0 (compile), 
commons-logging:commons-logging:jar:1.0.3 (compile), commons-pool:commons-pool:jar:1.2 (compile), 
commons-validator:commons-validator:jar:1.0.2 (compile), xalan:xalan:jar:2.5.1 (compile), 
xerces:xercesImpl:jar:2.4.0 (compile), xml-apis:xml-apis:jar:1.0.b2 (compile), com.oracle:ojdbc14:jar:9.0.2.0.0 (compile),
 hsqldb:hsqldb:jar:1.7.1 (compile), p6spy:p6spy:jar:1.1 (compile), hibernate:hibernate:jar:2.1.6 (compile), 
 javax.transaction:jta:jar:1.1 (compile), ehcache:ehcache:jar:0.9 (compile), c3p0:c3p0:jar:0.8.4.5 (compile), 
cglib:cglib:jar:2.0.1 (compile), dom4j:dom4j:jar:1.4 (compile), odmg:odmg:jar:3.0 (compile), 
 javax.xxx:xxx:jar:api:2.1 (compile), com.lowagie:itext:jar:1.3.1 (compile), org.slf4j:slf4j-api:jar:1.6.1 (compile),
 org.slf4j:slf4j-nop:jar:1.6.1 (compile), org.dbunit:dbunit:jar:2.4.8 (compile), xdoclet:xdoclet-ejb-module:jar:1.2.3 (compile), 
 xdoclet:xdoclet:jar:1.2.3 (compile), xdoclet:xdoclet-hibernate-module:jar:1.2.3 (compile), 
 xdoclet:xjavadoc:jar:1.5 (runtime)]:
 Failed to read artifact descriptor for commons-beanutils:commons-beanutils:jar:1.4-dev: Could not transfer artifact commons-beanutils:commons-beanutils:pom:1.4-dev: ConnectException: UnresolvedAddressException -> [Help 1]

These dependencies are all included in my pom.xml . 这些依赖项都包含在我的pom.xml Any idea of how to solve this? 知道怎么解决这个问题吗? I have tried adding a settings.xml, but in vain. 我试过添加一个settings.xml,但是徒劳无功。 Settings.xml : Settings.xml

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      https://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository>C:\Users\abc\.m2\repository</localRepository>
  <interactiveMode/>
  <usePluginRegistry/>
  <offline/>
  <pluginGroups/>
  <servers/>
  <mirrors/>
  <proxies/>
  <profiles/>
  <activeProfiles/>

Please help, I am stuck. 请帮忙,我被卡住了。

You need to configure your settings.xml to point towards one or more repositories that host the artifacts that you're looking for. 您需要将settings.xml配置为指向一个或多个托管您正在查找的工件的存储库。 They will be downloaded into your local repository. 它们将被下载到您的本地存储库中。 For example: 例如:

<profiles>
    <profile>
        <id>central</id>
        <activation>
           <activeByDefault>true</activeByDefault>
        </activation>
        <repositories>
            <repository>
                <id>central</id>
                <url>http://repo1.maven.org/maven2</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>central</id>
                <url>http://repo1.maven.org/maven2</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </pluginRepository>
        </pluginRepositories>
    </profile>
</profiles>

I am not sure you can read files of other users on computer. 我不确定您是否可以在计算机上阅读其他用户的文件。 Relocate your maven repository to another path, for example C:/maven_repository and change in your maven settings the local path. 将maven存储库重新定位到另一个路径,例如C:/ maven_repository,并在maven设置中更改本地路径。 This case works for me. 这个案子适合我。

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

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