2011-11-20 74 views
0

我加了彈簧和JBoss庫我的pom.xml象下面這樣:Maven構件無法解析

<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"> 
    <name>MyProject</name> 
    <url>http://www.myproject.com</url> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.myproject</groupId> 
    <artifactId>myproject</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>war</packaging> 
    <dependencies> 
     <dependency> 
      <groupId>com.sun.faces</groupId> 
      <artifactId>jsf-api</artifactId> 
      <version>2.1.3-b02</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.sun.faces</groupId> 
      <artifactId>jsf-impl</artifactId> 
      <version>2.1.3_01</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>jstl</artifactId> 
      <version>1.0.2</version> 
      <scope>runtime</scope> 
     </dependency> 
     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>servlet-api</artifactId> 
      <version>3.0-alpha-1</version> 
      <scope>runtime</scope> 
     </dependency> 
     <dependency> 
      <groupId>taglibs</groupId> 
      <artifactId>standard</artifactId> 
      <version>1.1.2</version> 
      <scope>runtime</scope> 
     </dependency> 

     <!-- SPRING DEPENDENCIES --> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring</artifactId> 
      <version>3.0.6.RELEASE</version> 
     </dependency> 

     <!-- HIBERNATE DEPENDENCIES --> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate</artifactId> 
      <version>3.5.4-Final</version> 
     </dependency> 

     <!-- PRIMEFACES --> 
     <dependency> 
      <groupId>org.primefaces</groupId> 
      <artifactId>primefaces</artifactId> 
      <version>3.0.M4</version> 
     </dependency> 
     <dependency> 
      <groupId>org.primefaces.themes</groupId> 
      <artifactId>aristo</artifactId> 
      <version>1.0.1</version> 
     </dependency> 

     <!-- OTHER DEPENDENCIES --> 
     <dependency> 
      <groupId>org.jsoup</groupId> 
      <artifactId>jsoup</artifactId> 
      <version>1.5.2</version> 
     </dependency> 
     <dependency> 
      <groupId>commons-codec</groupId> 
      <artifactId>commons-codec</artifactId> 
      <version>1.5</version> 
     </dependency> 
     <dependency> 
      <groupId>mysql</groupId> 
      <artifactId>mysql-connector-java</artifactId> 
      <version>5.1.18</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>net.authorize</groupId> 
      <artifactId>java-anet-sdk</artifactId> 
      <version>1.4.2</version> 
     </dependency> 
     <dependency> 
      <groupId>com.amazonaws</groupId> 
      <artifactId>aws-java-sdk</artifactId> 
      <version>1.2.12</version> 
     </dependency> 
     <dependency> 
      <groupId>com.ocpsoft</groupId> 
      <artifactId>prettyfaces-jsf2</artifactId> 
      <version>3.3.2</version> 
     </dependency> 
     <dependency> 
      <groupId>javax</groupId> 
      <artifactId>javaee-web-api</artifactId> 
      <version>6.0</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>4.8.1</version> 
      <scope>test</scope> 
     </dependency> 
    </dependencies> 

    <properties> 
     <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <netbeans.hint.j2eeVersion>1.6</netbeans.hint.j2eeVersion> 
     <netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server> 
    </properties> 

    <repositories> 
     <repository> 
      <id>jsf20</id> 
      <name>Repository for library Library[jsf20]</name> 
      <url>http://download.java.net/maven/2/</url> 
      <layout>default</layout> 
     </repository> 
     <repository> 
      <id>prime-repo</id> 
      <name>PrimeFaces Maven Repository</name> 
      <url>http://repository.primefaces.org</url> 
      <layout>default</layout> 
     </repository> 
     <repository> 
      <id>jboss-public-repository-group</id> 
      <name>JBoss Public Maven Repository Group</name> 
      <url>https://repository.jboss.org/nexus/content/repositories/releases/</url> 
      <layout>default</layout> 
     </repository> 
     <repository> 
      <id>spring-release</id> 
      <name>Spring Release Repository</name> 
      <url>http://maven.springframework.org/release</url> 
      <layout>default</layout> 
     </repository> 
    </repositories> 
    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.3.2</version> 
       <configuration> 
        <source>1.6</source> 
        <target>1.6</target> 
        <compilerArguments> 
         <endorseddirs>${endorsed.dir}</endorseddirs> 
        </compilerArguments> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-war-plugin</artifactId> 
       <version>2.1</version> 
       <configuration> 
        <failOnMissingWebXml>false</failOnMissingWebXml> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-dependency-plugin</artifactId> 
       <version>2.1</version> 
       <executions> 
        <execution> 
         <phase>validate</phase> 
         <goals> 
          <goal>copy</goal> 
         </goals> 
         <configuration> 
          <outputDirectory>${endorsed.dir}</outputDirectory> 
          <silent>true</silent> 
          <artifactItems> 
           <artifactItem> 
            <groupId>javax</groupId> 
            <artifactId>javaee-endorsed-api</artifactId> 
            <version>6.0</version> 
            <type>jar</type> 
           </artifactItem> 
          </artifactItems> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
     <finalName>${project.artifactId}</finalName> 
    </build> 
    <!--pluginRepositories> 
     <pluginRepository> 
      <id>caucho</id> 
      <name>Caucho</name> 
      <url>http://caucho.com/m2</url> 
     </pluginRepository> 
    </pluginRepositories--> 
</project> 

但是,當我建,我得到一個錯誤:

The following artifacts could not be resolved: org.springframework:spring:jar:3.0.6.RELEASE, org.hibernate:hibernate:jar:3.5.4-Final: Could not find artifact org.springframework:spring:jar:3.0.6.RELEASE in jsf20 (http://download.java.net/maven/2/) -> [Help 1] 

這就像maven只查看第一個存儲庫,而不是爲spring和hibernate定義的存儲庫。

更新:跑了-X和-e選項在命令行而不是從我可以告訴非常有用:http://pastebin.com/c7nPzBc2

+0

奇怪,因爲春天在maven central有售。應該沒有必要爲此特別回購。另外,我建議只包括你實際使用的彈簧工件。機會是你不使用_everything_。 – Lucas

回答

2

該錯誤只是說,它不能在java.net回購可以發現,它應該繼續並檢查其他人,直到找到確實擁有它的人。你應該能夠安全地忽略這一點。

此外,你列出的春天的網址似乎已經死了,它給了我錯誤500當我嘗試直接去那裏。無論哪種方式,它是不必要的,因爲春天工件可以在Maven中心找到(至少通過3.0.6你列出作爲你的依賴)。


多一點調查後,我發現因爲2.5.6春天並沒有公佈一個spring神器。您將需要單獨指定每個工件。例如:

<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-beans</artifactId> 
    <version>3.0.6.RELEASE</version> 
</dependency> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-jdbc</artifactId> 
    <version>3.0.6.RELEASE</version> 
</dependency> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-context</artifactId> 
    <version>3.0.6.RELEASE</version> 
</dependency> 
... 
+0

我在嘗試在Netbeans中構建時遇到該錯誤,並且因爲此問題而顯示「構建失敗」。 – Adam

+0

嘗試從命令行構建相同的項目。並使用-X選項獲取更多詳細信息。可能是它嘗試下一個回購,獲取錯誤500並退出。不知道雖然... – Lucas

+0

添加命令行輸出 – Adam

相關問題