编写 WSO2 连接器:从原型创建 Maven 项目模板不起作用

Writing a WSO2 Connector: Create the Maven project template from archetype not work

我在文档上试过这个 tutorial。wso2.com 但是步骤 从原型

创建 Maven 项目模板
mvn archetype:generate -DarchetypeGroupId=org.wso2.carbon.extension.archetype -DarchetypeArtifactId=org.wso2.carbon.extension.esb.connector-archetype -DarchetypeVersion=2.0.0 -DgroupId=org.wso2.carbon.connector -DartifactId=org.wso2.carbon.connector.helloworld -Dversion=1.0.0 -DarchetypeRepository=http://maven.wso2.org/nexus/content/repositories/wso2-public/

失败并出现错误:

...
    [INFO] Generating project in Interactive mode
    [WARNING] Archetype not found in any catalog. Falling back to central repository (http://repo.maven.apache.org/maven2).
    [WARNING] Use -DarchetypeRepository=<your repository> if archetype's repository is elsewhere.
    Downloading: http://repo.maven.apache.org/maven2/org/wso2/carbon/extension/archetype/org.wso2.carbon.extension.esb.connector-archetype/2.0.0/org.wso2.carbon.ext
    ension.esb.connector-archetype-2.0.0.pom
    [WARNING] The POM for org.wso2.carbon.extension.archetype:org.wso2.carbon.extension.esb.connector-archetype:jar:2.0.0 is missing, no dependency information avai
    lable
    Downloading: http://repo.maven.apache.org/maven2/org/wso2/carbon/extension/archetype/org.wso2.carbon.extension.esb.connector-archetype/2.0.0/org.wso2.carbon.ext
    ension.esb.connector-archetype-2.0.0.jar
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 5.055 s
    [INFO] Finished at: 2017-03-09T11:34:17+01:00
    [INFO] Final Memory: 16M/218M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.0:generate (default-cli) on project standalone-pom: The desired archetype doe
    s not exist (org.wso2.carbon.extension.archetype:org.wso2.carbon.extension.esb.connector-archetype:2.0.0) -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.0:generate (default-cli) on p
    roject standalone-pom: The desired archetype does not exist (org.wso2.carbon.extension.archetype:org.wso2.carbon.extension.esb.connector-archetype:2.0.0)

文档不完善还是我的错误?
有原型可以开始编写自定义 Java 连接器吗?

在错误消息中,它显示为“http://repo.maven.apache.org/maven2”。你能检查maven版本吗?如果不是maven2,安装maven2然后试试那个原型。

检查您的本地 Maven 存储库中是否有:

[MAVEN_REPO]\org\wso2\carbon\extension\archetype\org.wso2.carbon.extension.esb.connector-archetype.0.0\org.wso2.carbon.extension.esb.connector-archetype-2.0.0.jar

[MAVEN_REPO]\org\wso2\carbon\extension\archetype\org.wso2.carbon.extension.esb.connector-archetype.0.0\org.wso2.carbon.extension.esb.connector-archetype-2.0.0.pom

最后用 -e 重试并删除

中的所有内容
[MAVEN_REPO]\org\wso2\carbon\extension\archetype\org.wso2.carbon.extension.esb.connector-archetype.0.0\

转到 https://github.com/wso2-extensions/archetypes 并克隆 您有兴趣构建的原型项目。

如果 mvn create 命令失败,使用 pom 创建一个 java 项目 在原型项目中可用。

对pom中不同工件的版本进行更正 在 wso2 maven 存储库中可用。