Maven 2 无法解析Maven工件

Maven 2 无法解析Maven工件,maven-2,maven,maven-3,pom.xml,Maven 2,Maven,Maven 3,Pom.xml,我在pom.xml中添加了spring和jboss存储库,如下所示: <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"

我在pom.xml中添加了spring和jboss存储库,如下所示:

<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>
就像maven只查看第一个存储库,而不是为spring和hibernate定义的存储库


更新:在命令行中使用-X和-e选项运行,但从我所知道的情况来看,这不是很有用:

错误只是说在java.net repo中找不到它,它应该继续并检查其他选项,直到找到一个有它的。你应该能够安全地忽略这一点

另外,您为spring列出的url似乎已失效,当我尝试直接转到那里时,它会给我错误500。无论哪种方式,它都是不必要的,因为可以在maven central中找到spring工件(至少通过3.0.6,您将其列为您的依赖项)


经过进一步的调查,我发现spring从那时起就没有发布过
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>
...

org.springframework
春豆
3.0.6.1发布
org.springframework
SpringJDBC
3.0.6.1发布
org.springframework
spring上下文
3.0.6.1发布
...

奇怪,因为maven central提供spring。应该没有必要为此进行特别回购。另外,我建议只包括您实际使用的spring工件。很可能你没有使用所有的东西。当我尝试在Netbeans中构建时,我遇到了这个错误,因为它会显示“构建失败”。请尝试从命令行构建相同的项目。并使用-X选项了解更多详细信息。可能是它尝试下一次回购,得到错误500并退出。但不确定。。。
<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>
...