0

我正在尝试使用 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被拒绝:连接超时:连接 -> [帮助 1]

4

2 回答 2

4

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

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

如果这不是一个选择,最终你可以

  1. 请求 neethi 项目维护者在 maven Central 中发布 neethi 2.0.1(并添加从旧 org.apache.ws.commons.neethi groupId 到 org.apache.neethi 的重定向)
  2. 签出 neethi 2.0.1 标签并在本地安装。

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

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

于 2013-05-07T17:09:18.940 回答
2

我想我从昨天开始就遇到了同样的问题。基本上 Maven 正在尝试下载 2 个 POM 文件:

  • org/apache/santuario/xmlsec/1.4.1/xmlsec-1.4.1.pom
  • bouncycastle/bcprov-jdk13/132/bcprov-jdk13-132.pom

我猜它们是由 Spring 框架所依赖的,它们曾经可以从公共存储库中获得,而不再以某种方式获得。

我要解决的是,将这 2 个 POM 上传到我的本地存储库。2 空 POM,它们不依赖于其他任何人。

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.apache.santuario</groupId>
  <artifactId>xmlsec</artifactId>
  <version>1.4.1</version>
</project>

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>bouncycastle</groupId>
  <artifactId>bcprov-jdk13</artifactId>
  <version>132</version>
</project>
于 2012-04-25T19:13:54.153 回答