wso2wso2-micro-integrator

WSO2 - Failure when building the Data Mapper


I've been following the steps from the tutorial below on message transformation:

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

The problem I've run into is when I'm trying to Build & Run the project. I receive the following output:

[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

I've been racking my brain over it for days and still cannot crack it. The solution I see passed around the most (which is also suggested in the cwiki pages above) is to add a default goal (see below) in the pom.xml file, inside the build, but either I'm doing something wrong when I add it or this is not the cause of the issue.

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

I've tried running the 'mvn clean install' command and also delete the .m2\repository\ folder in-between attempts, but to no avail.

This is the pom.xml file:

<?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>

For context, I'm using the following Apache Maven & JDK versions:

Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)

Maven home: C:\Apache-Maven-3.8.8

Java version: 17.0.12, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-17

Default locale: en_GB, platform encoding: Cp1252

OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"


Solution

  • This is an unexpected outcome when compiling the Datamapper artifacts. It has occurred due to a space in the project path. This has been reported[1] and will be fixed in the next release.

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