2013-06-28 106 views
1

我已經在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 

Maven項目下面的問題,而我的pom.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> 

我刪除了回購協議並重新構建,但問題仍然存在。

任何幫助表示讚賞。 非常感謝!

回答

1

的第一件事是您在存儲庫...(http://www.jets3t.org/maven2): Access denied to: http://www.jets3t.org/maven2/org/...

除此之外庫並不像Maven倉庫錯誤的憑據。

而且http://ericbottard.github.com/cloudfoundry-tomcat-7給出的頁面沒有找到,這給我的印象這不是一個有效的存儲庫。

此外,我會建議首先使用Maven Central,這意味着您的pom.xml文件中沒有任何存儲庫條目,這是錯誤的方式。

只需檢查它是否在沒有存儲庫定義的情況下工作。如果您確實需要更好地定義其他存儲庫,請使用存儲庫管理器(Artifactory,Nexus,Archiva)。

另外一件事是,我在你的pom中看到了這個版本,這個版本已經是一個發佈版本,它已經與開發並沒有準備好。所以最好的辦法是使用適用於開發的SNAPSHOT版本。

+0

非常感謝!你的回答幫助我解決了我的問題。這是關於我沒有正確提供的憑證。 – user2008973

相關問題