在 wso2 中构建 Maven 多模块项目时出错

Error while building a maven multi module project in wso2

我正在使用 WSO2 微型集成器开发 POC,我创建了一个包含 EBS 工件、复合应用程序、注册表和 Kubernetes 导出器的多 maven 项目。当我尝试使用父 multimaven pom 构建项目时,出现以下错误:

[INFO] Building EmployeeInfo 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ EmployeeInfo ---
[INFO] Deleting /Users/ishantgarg/IntegrationStudio/deployment_workspace/POC_EmployeeInfo/EmployeeInfo/target/capp
[INFO] 
[INFO] --- wso2-esb-api-plugin:2.1.0:pom-gen (api) @ EmployeeInfo ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] POC_EmployeeInfo ................................... SUCCESS [  0.682 s]
[INFO] EmployeeInfo ....................................... FAILURE [  0.091 s]
[INFO] EmployeeInfoRegistry ............................... SKIPPED
[INFO] EmployeeInfoCompositeApplication ................... SKIPPED
[INFO] EmployeeInfoKubernetsExporter ...................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:37 min
[INFO] Finished at: 2020-04-29T10:11:25+02:00
[INFO] Final Memory: 27M/93M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.wso2.maven:wso2-esb-api-plugin:2.1.0:pom-gen (api) on project EmployeeInfo: Execution api of goal org.wso2.maven:wso2-esb-api-plugin:2.1.0:pom-gen failed: A required class was missing while executing org.wso2.maven:wso2-esb-api-plugin:2.1.0:pom-gen: javax/activation/DataSource
[ERROR] -----------------------------------------------------
[ERROR] realm =    extension>org.wso2.maven:wso2-esb-api-plugin:2.1.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/ishantgarg/.m2/repository/org/wso2/maven/wso2-esb-api-plugin/2.1.0/wso2-esb-api-plugin-2.1.0.jar
[ERROR] urls[1] = file:/Users/ishantgarg/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar
[ERROR] urls[2] = file:/Users/ishantgarg/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.4/plexus-component-annotations-1.5.4.jar
[ERROR] urls[3] = file:/Users/ishantgarg/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
[ERROR] urls[4] = file:/Users/ishantgarg/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
[ERROR] urls[5] = file:/Users/ishantgarg/.m2/repository/org/apache/maven/maven-archiver/2.2/maven-archiver-2.2.jar
[ERROR] urls[6] = file:/Users/ishantgarg/.m2/repository/org/apache/maven/shared/maven-dependency-tree/1.2/maven-dependency-tree-1.2.jar
[ERROR] urls[7] = file:/Users/ishantgarg/.m2/repository/org/apache/xbean/xbean-reflect/3.4/xbean-reflect-3.4.jar
[ERROR] urls[8] = file:/Users/ishantgarg/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar
[ERROR] urls[9] = file:/Users/ishantgarg/.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar
[ERROR] urls[10] = file:/Users/ishantgarg/.m2/repository/com/google/collections/google-collections/1.0/google-collections-1.0.jar
[ERROR] urls[11] = file:/Users/ishantgarg/.m2/repository/org/codehaus/plexus/plexus-archiver/1.0-alpha-7/plexus-archiver-1.0-alpha-7.jar
[ERROR] urls[12] = file:/Users/ishantgarg/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.1/plexus-utils-2.0.1.jar
[ERROR] urls[13] = file:/Users/ishantgarg/.m2/repository/org/wso2/maven/org.wso2.maven.capp/2.1.0/org.wso2.maven.capp-2.1.0.jar
[ERROR] urls[14] = file:/Users/ishantgarg/.m2/repository/org/apache/ws/commons/axiom/wso2/axiom/1.2.11.wso2v4/axiom-1.2.11.wso2v4.jar
[ERROR] urls[15] = file:/Users/ishantgarg/.m2/repository/org/wso2/maven/org.wso2.maven.utils/2.1.0/org.wso2.maven.utils-2.1.0.jar
[ERROR] urls[16] = file:/Users/ishantgarg/.m2/repository/org/wso2/maven/org.wso2.maven.core/2.1.0/org.wso2.maven.core-2.1.0.jar
[ERROR] urls[17] = file:/Users/ishantgarg/.m2/repository/org/wso2/maven/org.wso2.maven.esb/2.1.0/org.wso2.maven.esb-2.1.0.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------: javax.activation.DataSource
[ERROR] -> [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/PluginContainerException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :EmployeeInfo

我已尝试清理我的本地存储库,但此应用程序仅包含一个 REST API,它以成功消息作为响应。没有逻辑。

我还尝试从 Internet 下载基本代码片段并尝试构建它们。我犯了同样的错误。会不会和我本地电脑的maven配置有关?

由于 maven 使用的 java 版本,我遇到了这个问题。我安装了 maven 版本 3.6.x 使用 brew 发现在内部使用 java 13.

我发现 wso2 项目的 Maven 构建不适用于 java 高于 8 的版本。

为了解决这个问题,我从 apache 的网站安装了二进制 maven 并将其配置为使用 java 8,结果我能够成功构建 maven 多模块项目。

简答:停止使用 WSO2

长答案:自 Java 9 起,javax.activation 库默认不包含在 JDK 中。因此,您必须向每个需要的插件添加以下依赖项 javax.activation图书馆。

<dependencies>
    <dependency>
        <groupId>com.sun.activation</groupId>
        <artifactId>javax.activation</artifactId>
        <version>1.2.0</version>
    </dependency>
</dependencies>

运行 行家。阅读错误消息以了解哪个插件需要依赖项。 将其添加为依赖项并一遍又一遍地做同样的事情,直到没有更多的插件 剩下的需要 javax.activation 库。

例如

<plugin>
    <groupId>org.wso2.maven</groupId>
    <artifactId>wso2-general-project-plugin</artifactId>
    <dependencies>
        <dependency>
            <groupId>com.sun.activation</groupId>
            <artifactId>javax.activation</artifactId>
            <version>1.2.0</version>
        </dependency>
    </dependencies>
</plugin>

在您的错误消息中,插件名称是 wso2-esb-api-plugin