WSO2样本Maven pom.xml

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了WSO2样本Maven pom.xml相关的知识,希望对你有一定的参考价值。

我想将我的wso2项目打包到Maven中,第一步是将WSO2样本放到maven构建中,然后构建它...但是,不能创建到目前为止编译示例代码的pom.xml。

在线跟踪了一些小道:WSO2 BAM 2.0 libraries in Maven

其中包括将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:projectsacme.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:UsersTony.m2
epositoryorgwso2carboncarbon-components3.2.0carbon-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:UsersTony.m2
epositoryorgwso2carboncarbon-components3.2.0carbon-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
答案

你可以像这样构建这个pom文件,

mvn clean install -c

这将忽略校验和错误。

另一答案

用以下内容替换您的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>

以上是关于WSO2样本Maven pom.xml的主要内容,如果未能解决你的问题,请参考以下文章

maven pom.xml解释 (转)

从代码中的 maven pom.xml 检索版本

pom.xml文件

如何在 Maven 中从 pom.xml 调用 testng.xml 文件

maven上手

配置 Sonar 以从 Maven pom.xml 中排除文件