Maven错误:未能在项目上执行目标:无法解决项目的依赖关系

时间:2021-07-16 10:52:16

I have the following problem in a maven project in both eclipse and netbeans

在eclipse和netbeans的maven项目中,我有以下问题。

    Failed to execute goal on project ui: 
    Could not resolve dependencies for project <<package>>:ui:war:1.0: Failed to collect dependencies for [javax.servlet:servlet-api:jar:2.5 (provided), 
    org.springframework:spring-core:jar:3.0.5.RELEASE (compile), 
    org.springframework:spring-web:jar:3.0.5.RELEASE (compile), 
    cglib:cglib:jar:2.2 (compile), org.springframework:spring-aop:jar:3.0.5.RELEASE (compile), 
    org.springframework:spring-webmvc:jar:3.0.5.RELEASE (compile), org.springframework:spring-context:jar:3.0.5.RELEASE (compile), 
    org.freemarker:freemarker:jar:2.3.18 (compile), gr.imu.ntua.tweetinspire:services:jar:1.0 (compile), 
    org.cloudfoundry.samples:tomcat7-standalone:tar.gz:7.0.29 (compile), org.slf4j:slf4j-api:jar:1.6.1 (compile), 
    org.slf4j:slf4j-log4j12:jar:1.6.1 (compile), org.slf4j:jcl-over-slf4j:jar:1.6.1 (compile), 
    commons-logging:commons-logging:jar:1.1.1 (compile), junit:junit:jar:4.8.1 (test), 
    org.springframework:spring-test:jar:3.0.5.RELEASE (test), org.dbunit:dbunit:jar:2.4.8 (test)]: Failed to read artifact descriptor for org.cloudfoundry.samples:tomcat7-standalone:tar.gz:7.0.29: Could not transfer artifact org.cloudfoundry.samples:tomcat7-standalone:pom:7.0.29 from/to jets3t (http://www.jets3t.org/maven2): Access denied to: http://www.jets3t.org/maven2/org/cloudfoundry/samples/tomcat7-standalone/7.0.29/tomcat7-standalone-7.0.29.pom, ReasonPhrase:Forbidden

while my pom.xml file is:

而我的砰的一声。xml文件是:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <parent>
            <artifactId>core</artifactId>
            <groupId>gr.imu.ntua.tweetinspire</groupId>
            <version>1.0</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>

        <artifactId>ui</artifactId>
        <name>${project.groupId}.${project.artifactId}</name>
        <packaging>war</packaging>

        <dependencies>

            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>servlet-api</artifactId>
                <version>2.5</version>
                <scope>provided</scope>
            </dependency>


            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
            </dependency>

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
            </dependency>


            <dependency>
                <groupId>cglib</groupId>
                <artifactId>cglib</artifactId>
            </dependency>

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aop</artifactId>
            </dependency>


            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
            </dependency>

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
            </dependency>

            <!-- Freemarker -->
            <dependency>
                <groupId>org.freemarker</groupId>
                <artifactId>freemarker</artifactId>
                <version>2.3.18</version>
            </dependency>

            <dependency>
                <groupId>${project.groupId}</groupId>
                <version>${project.version}</version>
                <artifactId>services</artifactId>
            </dependency>
            <dependency>
                <groupId>org.cloudfoundry.samples</groupId>
                <artifactId>tomcat7-standalone</artifactId>
                <version>7.0.29</version>
                <type>tar.gz</type>
            </dependency>
        </dependencies>

        <build>

            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>package-inside-tomcat7</id>
                            <phase>package</phase>
                            <goals>
                                <goal>attached</goal>
                            </goals>
                            <configuration>
                                <descriptors>
                                    <descriptor>${basedir}/src/assembly/tomcat7.xml</descriptor>
                                </descriptors>
                                <appendAssemblyId>false</appendAssemblyId>
                                <finalName>tomcat7</finalName>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

            </plugins>
        </build>

        <repositories>
            <repository>
                <id>tomcat7-standalone-repo</id>
                <url>http://ericbottard.github.com/cloudfoundry-tomcat-7</url>
            </repository>
        </repositories>

    </project> 

I have deleted the repos and build again but the problem remains.

我已经删除了repos并重新构建,但是问题仍然存在。

Any help is appreciated. Thank you very much!

任何帮助都是感激。非常感谢!

1 个解决方案

#1


1  

The first thing is you are having the wrong credentials for the repository ...(http://www.jets3t.org/maven2): Access denied to: http://www.jets3t.org/maven2/org/...

首先,您对存储库有错误的凭据…(http://www.jets3t.org/maven2):访问被拒绝:http://www.jets3t.org/maven2/org/..。

Apart from that the repository does not look like Maven repository.

除此之外,存储库看起来不像Maven存储库。

And also the http://ericbottard.github.com/cloudfoundry-tomcat-7 gives a page not found which gives me the impression this is not a valid repository.

还有http://ericbottard.github.com/cloudfoundry-tomcat-7提供了一个没有找到的页面,给我的印象是这不是一个有效的存储库。

Furthermore i would suggest first to use Maven Central only which means no repository entries in your pom.xml files which is the wrong way at all.

此外,我建议您首先只使用Maven Central,这意味着您的pom中没有存储库条目。这是完全错误的xml文件。

Just check if it works without the repository definition. If you really need to define other repository better use a repository manager (Artifactory, Nexus, Archiva).

检查它是否在没有存储库定义的情况下运行。如果您确实需要定义其他存储库,最好使用存储库管理器(Artifactory、Nexus、Archiva)。

One other thing is that i see in your pom the version which is a released versions already in contradiction beeing not ready with development. So the best would be to use a SNAPSHOT version which is intended for development.

另一件事是,我在你们的pom中看到的是一个已经发布的版本,它已经与开发相矛盾了。因此,最好的方法是使用一个用于开发的快照版本。

#1


1  

The first thing is you are having the wrong credentials for the repository ...(http://www.jets3t.org/maven2): Access denied to: http://www.jets3t.org/maven2/org/...

首先,您对存储库有错误的凭据…(http://www.jets3t.org/maven2):访问被拒绝:http://www.jets3t.org/maven2/org/..。

Apart from that the repository does not look like Maven repository.

除此之外,存储库看起来不像Maven存储库。

And also the http://ericbottard.github.com/cloudfoundry-tomcat-7 gives a page not found which gives me the impression this is not a valid repository.

还有http://ericbottard.github.com/cloudfoundry-tomcat-7提供了一个没有找到的页面,给我的印象是这不是一个有效的存储库。

Furthermore i would suggest first to use Maven Central only which means no repository entries in your pom.xml files which is the wrong way at all.

此外,我建议您首先只使用Maven Central,这意味着您的pom中没有存储库条目。这是完全错误的xml文件。

Just check if it works without the repository definition. If you really need to define other repository better use a repository manager (Artifactory, Nexus, Archiva).

检查它是否在没有存储库定义的情况下运行。如果您确实需要定义其他存储库,最好使用存储库管理器(Artifactory、Nexus、Archiva)。

One other thing is that i see in your pom the version which is a released versions already in contradiction beeing not ready with development. So the best would be to use a SNAPSHOT version which is intended for development.

另一件事是,我在你们的pom中看到的是一个已经发布的版本,它已经与开发相矛盾了。因此,最好的方法是使用一个用于开发的快照版本。