我正在尝试使用Maven构建应用程序。

pom.xml

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.sjagdeesh.application</groupId>
    <artifactId>sample-ref-app</artifactId>
    <packaging>war</packaging>
    <version>2.0.0</version>
    <name>sample-ref-app Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <build>

        <plugins>
                 <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <configuration>
                    <container>
                        <containerId>tomcat6x</containerId>
                        <type>remote</type>
                    </container>
                    <configuration>
                        <type>runtime</type>
                        <properties>
                            <cargo.tomcat.manager.url>${tomcat.manager.url}</cargo.tomcat.manager.url>
                            <cargo.remote.username>${remote.username}</cargo.remote.username>
                            <cargo.remote.password>${remote.password}</cargo.remote.password>
                        </properties>
                    </configuration>
                    <deployer>
                        <type>remote</type>
                        <deployables>
                            <deployable>
                                <groupId>com.sjagdeesh.application</groupId>
                                <artifactId>sampleapp-web</artifactId>
                                <type>war</type>
                            </deployable>
                        </deployables>
                    </deployer>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.jibx</groupId>
                <artifactId>maven-jibx-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>

                    <directory>src/main/resources</directory>
                    <includes>
                        <includes>*binding.xml</includes>
                    </includes>
                    <verbose>true</verbose>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>bind</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <finalName>refapp-web</finalName>
    </build>
    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.3</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2</artifactId>
            <version>1.4.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-spring</artifactId>
            <version>1.4.1</version>
            <exclusions>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xercesImpl</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
            <version>1.5.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-spring</artifactId>
            <version>1.5.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-jms</artifactId>
            <version>1.5.0</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2</artifactId>
            <version>1.4.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-kernel</artifactId>
            <version>1.4.1</version>
            <exclusions>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xercesImpl</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xmlParserAPIs</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.jibx</groupId>
            <artifactId>jibx-bind</artifactId>
            <version>1.2.1</version>
        </dependency>
        <dependency>
            <groupId>org.jibx</groupId>
            <artifactId>jibx-run</artifactId>
            <version>1.2.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-jetty</artifactId>
            <version>1.5.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.geronimo.specs</groupId>
                    <artifactId>geronimo-servlet_2.4_spec</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.mortbay.jetty</groupId>
                    <artifactId>servlet-api-2.5</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.ws.commons.neethi
        </groupId>
            <artifactId>neethi</artifactId>
            <version>2.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.rampart</groupId>
            <artifactId>rampart-core</artifactId>
            <version>1.4</version>
            <exclusions>
                <exclusion>
                    <groupId>bouncycastle</groupId>
                    <artifactId>bcprov-jdk13</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xercesImpl</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>jaxen</groupId>
                    <artifactId>jaxen</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>jaxen</groupId>
            <artifactId>jaxen</artifactId>
            <version>1.1.1</version>
            <exclusions>
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xmlParserAPIs</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xercesImpl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
        </dependency>
         <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.6</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <properties>
        <spring.version>3.0.2.RELEASE</spring.version>
        </properties>

            <dependencies>
                <dependency>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                    <version>2.7.0</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>

            <dependencies>
                <dependency>
                    <groupId>javax.xml.bind</groupId>
                    <artifactId>jaxb-api</artifactId>
                    <version>2.1</version>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-impl</artifactId>
                    <version>2.1.6</version>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>xerces</groupId>
                    <artifactId>xercesImpl</artifactId>
                    <version>2.8.1</version>
                    <scope>provided</scope>
                    <exclusions>
                        <exclusion>
                            <artifactId>xml-apis</artifactId>
                            <groupId>xml-apis</groupId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <artifactId>xml-apis</artifactId>
                    <groupId>xml-apis</groupId>
                    <version>2.0.2</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>

                    <dependencies>
                <dependency>
                    <groupId>javax.xml.bind</groupId>
                    <artifactId>jaxb-api</artifactId>
                    <version>2.1</version>
                </dependency>
                <dependency>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-impl</artifactId>
                    <version>2.1.6</version>
                </dependency>
                <dependency>
                    <groupId>xerces</groupId>
                    <artifactId>xercesImpl</artifactId>
                    <version>2.8.1</version>
                    <exclusions>
                        <exclusion>
                            <artifactId>xml-apis</artifactId>
                            <groupId>xml-apis</groupId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <artifactId>xml-apis</artifactId>
                    <groupId>xml-apis</groupId>
                    <version>2.0.2</version>
                </dependency>
            </dependencies>

</project>


当我运行安装命令

mvn clean install


我收到此错误

[INFO] ------------------------------------------------------------------------
[INFO] Building ref-app-services-provider Maven Webapp 1.5.0
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/apache/ws/commons/neethi/neethi/2.0.1/neethi-2.0.1.pom
[WARNING] The POM for org.apache.ws.commons.neethi:neethi:jar:2.0.1 is missing, no dependency information available
Downloading: http://repo.maven.apache.org/maven2/bouncycastle/bcprov-jdk13/132/bcprov-jdk13-132.pom
Downloading: http://people.apache.org/repo/m2-snapshot-repository/bouncycastle/bcprov-jdk13/132/bcprov-jdk13-132.pom
Downloading: http://ws.zones.apache.org/repository2/bouncycastle/bcprov-jdk13/132/bcprov-jdk13-132.pom
Downloading: http://repo1.maven.org/maven2/bouncycastle/bcprov-jdk13/132/bcprov-jdk13-132.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/santuario/xmlsec/1.4.1/xmlsec-1.4.1.pom
Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/apache/santuario/xmlsec/1.4.1/xmlsec-1.4.1.pom
Downloading: http://ws.zones.apache.org/repository2/org/apache/santuario/xmlsec/1.4.1/xmlsec-1.4.1.pom
Downloading: http://repo.maven.apache.org/maven2/org/springframework/spring-beans/2.5.1/spring-beans-2.5.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/springframework/spring-beans/2.5.1/spring-beans-2.5.1.pom (3 KB at 1.8 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/springframework/spring-web/2.5.1/spring-web-2.5.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/springframework/spring-web/2.5.1/spring-web-2.5.1.pom (5 KB at 6.5 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 57.403s
[INFO] Finished at: Fri Apr 20 11:40:48 IST 2012
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project ref-app-services-provider-web: ref-app-services-provider-web:war:1.5.0: Failed to collect dependencies for [javax.servlet:servlet-api:jar:2.3 (provided), com.sjagdeesh.application:integration:jar:3
.1.0 (compile), org.apache.axis2:axis2:jar:1.4.1 (compile), org.apache.axis2:axis2-spring:jar:1.4.1 (compile), org.apache.camel:camel-core:jar:1.5.0 (
compile), org.apache.camel:camel-spring:jar:1.5.0 (compile), org.apache.camel:camel-jms:jar:1.5.0 (compile), commons-logging:commons-logging:jar:1.1 (
compile), commons-lang:commons-lang:jar:2.4 (compile), org.apache.axis2:axis2-kernel:jar:1.4.1 (compile), org.jibx:jibx-bind:jar:1.2.1 (compile), org.
jibx:jibx-run:jar:1.2.1 (compile), org.apache.camel:camel-jetty:jar:1.5.0 (compile), org.apache.ws.commons.neethi:neethi:jar:2.0.1 (compile), org.apac
he.rampart:rampart-core:jar:1.4 (compile), jaxen:jaxen:jar:1.1.1 (compile), org.springframework:spring-core:jar:3.0.2.RELEASE (compile), org.springfra
mework:spring-beans:jar:3.0.2.RELEASE (compile), org.springframework:spring-context:jar:3.0.2.RELEASE (compile), org.springframework:spring-web:jar:3.
0.2.RELEASE (compile), org.springframework:spring-context-support:jar:3.0.2.RELEASE (compile), junit:junit:jar:4.6 (test), javax.xml.bind:jaxb-api:jar
:2.1 (provided), com.sun.xml.bind:jaxb-impl:jar:2.1.6 (provided), xerces:xercesImpl:jar:2.8.1 (provided), xml-apis:xml-apis:jar:2.0.2 (provided)]: Fai
led to read artifact descriptor for bouncycastle:bcprov-jdk13:jar:132: Could not transfer artifact bouncycastle:bcprov-jdk13:pom:132 from/to apache-ws
-snapshots2 (http://ws.zones.apache.org/repository2): Connection to http://ws.zones.apache.org refused: Connection timed out: connect -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException


我已经交叉检查了错误堆栈中提到的所有jar,它们都存在于m2存储库中。

有人可以帮我解决这个错误的原因吗


  与http://ws.zones.apache.org的连接被拒绝:连接已计时
  out:连接-> [帮助1]

最佳答案

我在另一个使用Axis2的项目中遇到了同样的问题。问题是中央存储库中缺少特定org.apache.ws.commons.neethi:neethi:2.0.1的POM文件,但是目录和jar存在。
Maven 2.2.1似乎并不关心这个问题,但是Maven 3(和M2Eclipse)似乎更严格。
但是,似乎neethi现在生活在org.apache.neethi组下,但是maven Central中只有从2.0.2开始的发行版可用。
我能够解决将neethi降至2.0.2的问题(因为它是一个缺陷纠正版本,因此它不应该中断编译):

<dependencyManagement>
 <dependencies>
    <dependency>
       <groupId>org.apache.neethi</groupId>
       <artifactId>neethi</artifactId>
       <version>2.0.2</version>
    </dependency>
 </dependencies>




如果那不是一个选择,那么最终您可以


要求neethi项目维护者在maven Central中发布neethi 2.0.1(并从旧的org.apache.ws.commons.neethi groupId添加重定向到org.apache.neethi)
结帐neethi 2.0.1
tag并在本地安装。


您遇到的连接拒绝错误可以通过在maven的settings.xml中添加一个指向该存储库到Maven Central的镜像来解决。

PS:解决了neethi的问题后,jaxen:jaxen:1.1-beta-10也遇到了同样的问题。将其管理为jaxen:jaxen:1.1-beta-11使我超越了这一点。

10-08 16:29