WSO2 - 构建数据映射器时失败

问题描述 投票:0回答:1

我一直在遵循下面关于消息转换的教程中的步骤:

https://mi.docs.wso2.com/en/latest/learn/integration-tutorials/transforming-message-content/

我遇到的问题是当我尝试构建和运行项目时。我收到以下输出:

[INFO] ------------------< org.example:data-mapper-bundler >-------------------
[INFO] Building data-mapper-bundler 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.503 s
[INFO] Finished at: 2024-11-04T16:27:58+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "Projects\MessageTransformation1\target\node\npm.cmd". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [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/LifecyclePhaseNotFoundException
[ERROR] Failed to bundle data mapper: RequestMapping
[ERROR] Error during data mapper bundling: Failed to bundle data mapper: RequestMapping
org.wso2.maven.datamapper.DataMapperException: Failed to bundle data mapper: RequestMapping
    at org.wso2.maven.datamapper.DataMapperBundler.executeRequest (DataMapperBundler.java:349)
    at org.wso2.maven.datamapper.DataMapperBundler.bundleSingleDataMapper (DataMapperBundler.java:255)
    at org.wso2.maven.datamapper.DataMapperBundler.bundleDataMappers (DataMapperBundler.java:199)
    at org.wso2.maven.datamapper.DataMapperBundler.bundleDataMapper (DataMapperBundler.java:89)
    at org.wso2.maven.CARMojo.execute (CARMojo.java:92)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:299)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:963)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:296)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:199)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:13 min
[INFO] Finished at: 2024-11-04T16:27:58+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.wso2.maven:vscode-car-plugin:5.2.75:car (default) on project MessageTransformation1: Data Mapper bundling failed. Failed to bundle data mapper: RequestMapping -> [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/MojoExecutionException

我绞尽脑汁想了好几天了,还是无法破解。我看到最多的解决方案(上面的 cwiki 页面也建议了)是在构建内部的 pom.xml 文件中添加默认目标(见下文),但是当我添加它,否则这不是问题的原因。

<project>
  ...
  <build>
    <defaultGoal>install</defaultGoal>
    ...
  </build>
  ...
</project>

我尝试运行“mvn clean install”命令并删除 .m2 epository\ 文件夹中间尝试,但无济于事。

这是pom.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.microintegrator.projects</groupId>
  <artifactId>MessageTransformation1</artifactId>
  <version>1.0.0</version>
  <packaging>pom</packaging>
  <name>MessageTransformation1</name>
  <description>MessageTransformation1</description>
  <repositories>
    <repository>
        <id>wso2-nexus</id>
        <name>WSO2 internal Repository</name>
        <url>https://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>https://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>Apache Snapshot Repository</name>
        <url>https://maven.wso2.org/nexus/content/repositories/snapshots/</url>
        <snapshots>
          <enabled>true</enabled>
          <updatePolicy>daily</updatePolicy>
        </snapshots>
        <releases>
          <enabled>false</enabled>
        </releases>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>wso2.snapshots</id>
      <name>Apache Snapshot Repository</name>
      <url>https://maven.wso2.org/nexus/content/repositories/snapshots/</url>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
      </snapshots>
      <releases>
        <enabled>false</enabled>
      </releases>
    </pluginRepository>
    <pluginRepository>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
        <checksumPolicy>ignore</checksumPolicy>
      </releases>
      <id>wso2-nexus</id>
      <url>https://maven.wso2.org/nexus/content/groups/wso2-public/</url>
    </pluginRepository>
  </pluginRepositories>
  <profiles>
    <profile>
      <id>default</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <!-- Download dependency jars to the deployment/libs folder -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>3.5.0</version>
            <executions>
              <execution>
                <phase>process-resources</phase>
                <goals>
                  <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                  <outputDirectory>${basedir}/deployment/libs</outputDirectory>
                  <excludeTransitive>true</excludeTransitive>
                  <!-- exclude dependencies which already available in MI -->
                  <excludeGroupIds>org.apache.synapse,org.apache.axis2</excludeGroupIds>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.13.0</version>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.wso2.maven</groupId>
            <artifactId>vscode-car-plugin</artifactId>
            <version>5.2.75</version>
            <extensions>true</extensions>
            <executions>
              <execution>
                <phase>compile</phase>
                <goals>
                  <goal>car</goal>
                </goals>
                <configuration/>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-install-plugin</artifactId>
            <version>2.5.2</version>
            <executions>
              <execution>
                <id>install-car</id>
                <phase>compile</phase>
                <goals>
                  <goal>install-file</goal>
                </goals>
                <configuration>
                  <packaging>car</packaging>
                  <artifactId>${project.artifactId}</artifactId>
                  <groupId>${project.groupId}</groupId>
                  <version>${project.version}</version>
                  <file>${project.build.directory}/${project.artifactId}_${project.version}.car</file>
                  <!-- Use the following configuration when archiveLocation is configured -->
                  <!-- <file>${archiveLocation}/${project.artifactId}_${project.version}.car</file> -->
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <properties>
        <server.type>local</server.type>
        <server.host>localhost</server.host>
        <server.port>9008</server.port>
        <server.path>/</server.path>
        <server.version>${project.runtime.version}</server.version>
        <server.download.link>${testServerDownloadLink}</server.download.link>
      </properties>
    </profile>
    <profile>
      <id>test</id>
      <build/>
      <properties>
        <server.type>${testServerType}</server.type>
        <server.host>${testServerHost}</server.host>
        <server.port>${testServerPort}</server.port>
        <server.path>${testServerPath}</server.path>
      </properties>
    </profile>
    <profile>
      <id>docker</id>
      <build>
        <plugins>
            <!-- Compile and build the class mediator jars -->
            <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <executions>
              <execution>
                <id>default-compile</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>compile</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <executions>
              <execution>
                <id>default-jar</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!-- Build the Carbon Application -->
          <plugin>
            <groupId>org.wso2.maven</groupId>
            <artifactId>vscode-car-plugin</artifactId>
            <version>5.2.75</version>
            <extensions>true</extensions>
            <executions>
              <execution>
                <phase>generate-sources</phase>
                <goals>
                  <goal>car</goal>
                </goals>
                <configuration></configuration>
              </execution>
            </executions>
          </plugin>
          <!-- Download dependency jars to the deployment/libs folder -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>3.5.0</version>
            <executions>
              <execution>
                <phase>process-resources</phase>
                <goals>
                  <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                  <outputDirectory>${basedir}/deployment/libs</outputDirectory>
                  <excludeTransitive>true</excludeTransitive>
                  <!-- exclude dependencies which already available in MI -->
                  <excludeGroupIds>org.apache.synapse,org.apache.axis2</excludeGroupIds>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <!-- Run config mapper to transform configuration files -->
          <plugin>
            <groupId>org.wso2.maven</groupId>
            <artifactId>mi-container-config-mapper</artifactId>
            <version>5.2.75</version>
            <extensions>true</extensions>
            <executions>
              <execution>
                <id>config-mapper-parser</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>config-mapper-parser</goal>
                </goals>
                <configuration>
                  <miVersion>${project.runtime.version}</miVersion>
                  <executeCipherTool>${ciphertool.enable}</executeCipherTool>
                  <keystoreName>${keystore.name}</keystoreName>
                  <keystoreAlias>${keystore.alias}</keystoreAlias>
                  <keystoreType>${keystore.type}</keystoreType>
                  <keystorePassword>${keystore.password}</keystorePassword>
                  <projectLocation>${project.basedir}</projectLocation>
                </configuration>
              </execution>
            </executions>
            <configuration/>
          </plugin>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>3.0.0</version>
            <extensions>true</extensions>
            <executions>
              <execution>
                <id>antrun-edit</id>
                <phase>process-resources</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <target>
                    <copy todir="${basedir}/target/tmp_docker/CompositeApps">
                      <fileset dir="${basedir}/target">
                        <include name="*.car"/>
                      </fileset>
                    </copy>
                  </target>
                </configuration>
              </execution>
            </executions>
            <configuration/>
          </plugin>
          <!-- Build docker image -->
          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <version>0.45.0</version>
            <extensions>true</extensions>
            <executions>
              <execution>
                <id>docker-build</id>
                <phase>package</phase>
                <goals>
                  <goal>build</goal>
                </goals>
                <configuration>
                  <images>
                    <image>
                      <name>${project.artifactId}:${project.version}</name>
                      <build>
                        <from>${dockerfile.base.image}</from>
                        <dockerFile>${basedir}/target/tmp_docker/Dockerfile</dockerFile>
                        <args>
                          <BASE_IMAGE>${dockerfile.base.image}</BASE_IMAGE>
                        </args>
                        <useDefaultExcludes>false</useDefaultExcludes>
                      </build>
                    </image>
                  </images>
                  <authConfig>
                    <username>${dockerfile.pull.username}</username>
                    <password>${dockerfile.pull.password}</password>
                  </authConfig>
                  <verbose>true</verbose>
                </configuration>
              </execution>
            </executions>
            <configuration/>
          </plugin>
        </plugins>
      </build>
      <properties>
        <server.type>local</server.type>
        <server.host>localhost</server.host>
        <server.port>9008</server.port>
        <server.path>/</server.path>
        <server.version>${project.runtime.version}</server.version>
        <server.download.link>${testServerDownloadLink}</server.download.link>
      </properties>
    </profile>
  </profiles>
  <build>
    <plugins>
      <plugin>
        <groupId>org.wso2.maven</groupId>
        <artifactId>synapse-unit-test-maven-plugin</artifactId>
        <version>5.2.75</version>
        <executions>
          <execution>
            <id>synapse-unit-test</id>
            <phase>test</phase>
            <goals>
              <goal>synapse-unit-test</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <server>
            <testServerType>${server.type}</testServerType>
            <testServerHost>${server.host}</testServerHost>
            <testServerPort>${server.port}</testServerPort>
            <testServerPath>${server.path}</testServerPath>
            <testServerVersion>${server.version}</testServerVersion>
            <testServerDownloadLink>${server.download.link}</testServerDownloadLink>
          </server>
          <testCasesFilePath>${project.basedir}/src/test/wso2mi/${testFile}</testCasesFilePath>
          <mavenTestSkip>${maven.test.skip}</mavenTestSkip>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <properties>
    <projectType>integration-project</projectType>
    <uuid>28cba6f4-38e9-400c-a9f1-51b5b3c63eb3</uuid>
    <!-- <archiveLocation>configure a custom target directory for CAPP</archiveLocation> -->
    <keystore.type>JKS</keystore.type>
    <keystore.name>wso2carbon.jks</keystore.name>
    <keystore.password>wso2carbon</keystore.password>
    <keystore.alias>wso2carbon</keystore.alias>
    <ciphertool.enable>true</ciphertool.enable>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.scm.id>integration-project</project.scm.id>
    <project.runtime.version>4.3.0</project.runtime.version>
    <dockerfile.base.image>wso2/wso2mi:${project.runtime.version}</dockerfile.base.image>
  </properties>
</project>

对于上下文,我使用以下 Apache Maven 和 JDK 版本:

Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)

Maven 主目录:C:\Apache-Maven-3.8.8

Java 版本:17.0.12,供应商:Oracle Corporation,运行时:C:\Program Files\Java\jdk-17

默认区域设置:en_GB,平台编码:Cp1252

操作系统名称:“windows 11”,版本:“10.0”,架构:“amd64”,系列:“windows”

wso2 wso2-micro-integrator
1个回答
0
投票

这是编译 Datamapper 工件时的意外结果。这是由于项目路径中存在空格而发生的。此问题已被报告[1],并将在下一版本中修复。

[1] - https://github.com/wso2/mi-vscode/issues/502

© www.soinside.com 2019 - 2024. All rights reserved.