1

我想将我的 wso2 项目打包到 Maven 中,第一步是将 WSO2 示例放入 maven 构建中,然后在此基础上构建......但是,到目前为止,无法创建将编译示例代码的 pom.xml。

在线跟踪一些线索后: Maven 中的 WSO2 BAM 2.0 库

其中包括将 pom 下载并安装到本地存储库中,因为它在 wso2 存储库中不存在,仍然出现错误...

感谢您提供任何帮助或最好的帮助,如果有人有用于 WSO2 示例的 pom.xml 并且可以分享它...

这是当前的pom:

<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>
    <groupId>org.wso2.carbon</groupId>
    <artifactId>carbon-components</artifactId>
    <version>3.2.0</version>
</parent>


<repositories>
    <repository>
        <id>wso2-maven2-repository</id>
        <name>WSO2 Maven2 Repository</name>
        <url>http://dist.wso2.org/maven2</url>
        <snapshots>
        <enabled>true</enabled>
        </snapshots>
        <releases>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
        <checksumPolicy>fail</checksumPolicy>
        </releases>
    </repository>
</repositories>



<modelVersion>4.0.0</modelVersion>
<groupId>acme</groupId>
<artifactId>acme.wso2</artifactId>
<version>1.0-SNAPSHOT</version>

<dependencies>

    <dependency>
        <groupId>org.wso2.carbon</groupId>
        <artifactId>org.wso2.carbon.bam.agent</artifactId>
        <version>3.2.4</version>
    </dependency>

    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>6.0</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2</artifactId>
        <version>1.5.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.ws.commons.axiom</groupId>
        <artifactId>axiom-api</artifactId>
        <version>1.2.11</version>
    </dependency>


</dependencies>

</project>

以下是我在构建时收到的错误:

c:\projects\acme.wso2> mvn compile

[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for acme:acme.wso2:jar:1.0-SNAPSHOT
[WARNING] 'dependencyManagement.dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.wso2.carbon:org.wso2.carbon.core.common:jar -> duplicate declaration of version ${carbon.platform.version} @ org.wso2.carbon:c
arbon-components:3.2.0, C:\Users\Tony\.m2\repository\org\wso2\carbon\carbon-components\3.2.0\carbon-components-3.2.0.pom, line 1025, column 25
[WARNING] 'dependencyManagement.dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.wso2.carbon:org.wso2.carbon.mashup.jsservices.stub:jar -> duplicate declaration of version ${carbon.platform.version} @ org.ws
o2.carbon:carbon-components:3.2.0, C:\Users\Tony\.m2\repository\org\wso2\carbon\carbon-components\3.2.0\carbon-components-3.2.0.pom, line 2128, column 25
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building acme.wso2 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for net.sf.saxon:saxon:jar:8.9 is missing, no dependency information available
Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/eclipse/osgi/org.eclipse.osgi.services/3.2.0.v20
090520-1800/org.eclipse.osgi.services-3.2.0.v20090520-1800.pom
[WARNING] Checksum validation failed, expected <!DOCTYPE but is 8edc83998e0bf2a8867395883f3853eb901be267 for http://maven.wso2.org/nexus/content/groups/wso2-public/org/eclipse/osgi/org.eclipse.osgi.services/3.2.0.v20090520-1800/org.eclipse.osgi.services-3.2.0.v20090520-1800.pom
Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/bsf/bsf-all/3.0/bsf-all-3.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.956s
[INFO] Finished at: Thu Feb 07 16:43:12 EST 2013
[INFO] Final Memory: 12M/161M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project acme.wso2: Could not resolve dependencies for project acme:acme.wso2:jar:1.0-SNAPSHOT:
    Failed to collect dependencies for [org.wso2.carbon:org.wso2.carbon.bam.agent:jar:3.2.4 (compile),
    javax:javaee-api:jar:6.0 (provided),
    org.apache.axis2:axis2:jar:1.5.1 (compile),
    org.apache.ws.commons.axiom:axiom-api:jar:1.2.11 (compile)]:
    Failed to read artifact descriptor for org.eclipse.osgi:org.eclipse.osgi.services:jar:3.2.0.v20090520-1800:
    Could not transfer artifact org.eclipse.osgi:org.eclipse.osgi.services:pom:3.2.0.v20090520-1800 from/to wso2-nexus
    (http://maven.wso2.org/nexus/content/groups/wso2-public/):
    Checksum validation failed, expected <!DOCTYPE but is 8edc83998e0bf2a8867395883f3853eb901be267 -> [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
4

2 回答 2

2

你能像这样构建这个pom文件吗?

mvn 干净安装 -c

这将忽略校验和错误。

于 2014-03-17T03:43:16.070 回答
2

将您的repositories标签替换为以下内容。您的依赖项将在这些存储库之一中可用。如果校验和错误似乎仍然存在,请参考@Harsha 的回答。

<repositories>
    <repository>
        <id>wso2-nexus</id>
        <name>WSO2 internal Repository</name>
        <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
        <releases>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
            <checksumPolicy>ignore</checksumPolicy>
        </releases>
    </repository>
    <repository>
        <id>wso2.releases</id>
        <name>WSO2 internal Repository</name>
        <url>http://maven.wso2.org/nexus/content/repositories/releases/</url>
        <releases>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
            <checksumPolicy>ignore</checksumPolicy>
        </releases>
    </repository>
    <repository>
        <id>wso2.snapshots</id>
        <name>WSO2 Snapshot Repository</name>
        <url>http://maven.wso2.org/nexus/content/repositories/snapshots/</url>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
        </snapshots>
        <releases>
            <enabled>false</enabled>
        </releases>
    </repository>
</repositories>
于 2018-01-02T11:34:56.657 回答