frontend-maven-plugin
frontend-maven-plugin copied to clipboard
Cannot run program "npx" error=2, No such file or directory
I am trying to use frontend-maven-plugin 1.12.1 with maven 3.8.4. My pom configuration looks like below. But on doing mvn clean install I am getting the below error
Error: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:exec (validate api specs) on project master: Command execution failed.: Cannot run program "npx" (in directory "/opt/actions-runner/_work/spotnana/spotnana/src/java/obt/master/target"): error=2, No such file or directory -> [Help 1]
Error:
Can someone let me know what I am doing wrong?
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.12.1</version>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<!-- optional: default phase is "generate-resources" -->
<phase>initialize</phase>
<configuration>
<installDirectory>target</installDirectory>
<nodeVersion>v19.6.0</nodeVersion>
<npmVersion>9.5.0</npmVersion>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>install openapi merger</id>
<goals>
<goal>exec</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<executable>${project.basedir}/target/node/npm</executable>
<workingDirectory>${project.basedir}/target/node</workingDirectory>
<arguments>
<argument>install</argument>
<argument>openapi-merger</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>generate internal api spec</id>
<goals>
<goal>exec</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<executable>${project.basedir}/target/node/node_modules/.bin/openapi-merger
</executable>
<workingDirectory>${project.basedir}/target/node</workingDirectory>
<environmentVariables>
<PATH>${env.PATH}:${project.basedir}/target/node</PATH>
</environmentVariables>
<arguments>
<argument>-i</argument>
<argument>${project.basedir}/src/main/resources/yaml/apis/api/Api.yaml
</argument>
<argument>-o</argument>
<argument>${project.basedir}/src/main/resources/api/InternalApiSpec.yaml</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>validate api specs</id>
<goals>
<goal>exec</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<executable>npx</executable>
<workingDirectory>${project.basedir}/target</workingDirectory>
<environmentVariables>
<PATH>${env.PATH}:${project.basedir}/target/node</PATH>
</environmentVariables>
<arguments>
<argument>@redocly/cli@latest</argument>
<argument>lint</argument>
<argument>${project.basedir}/src/main/resources/api/PolicyApi.yaml</argument>
<argument>${project.basedir}/src/main/resources/api/CompanyApi.yaml</argument>
<argument>${project.basedir}/src/main/resources/api/UsersApi.yaml</argument>
<argument>${project.basedir}/src/main/resources/api/TripApi.yaml</argument>
<argument>${project.basedir}/src/main/resources/api/InternalApiSpec.yaml</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>