使用exec-maven-plugin在我的pom.xml中运行npm命令

时间:2018-10-01 16:13:02

标签: java node.js maven npm

我正在使用exec-maven-plugin来运行我的Maven构建以进行npm install,但是,出现以下错误并且不确定为什么?


错误是:

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:exec (exec- 
npm-install) on project ccg: Command execution failed. Cannot run program 
"C:\Program Files\nodejs\npm" (in directory "C:\Users\blah\git\ccg- 
service\src\main\app"): CreateProcess error=193, %1 is not a valid Win32 
application

我的pom.xml如下所示:

<plugin>
     <groupId>org.codehaus.mojo</groupId>
     <artifactId>exec-maven-plugin</artifactId>
     <executions>
         <execution>
             <id>exec-npm-install</id>
             <phase>generate-sources</phase>
             <configuration>                  
                  <workingDirectory>${project.basedir}src\main\app</workingDirectory>
                  <executable>npm</executable>
                  <arguments>
                       <argument>install</argument>
                  </arguments>
             </configuration>
             <goals>
                 <goal>exec</goal>
             </goals>
        </execution>
        <execution>
            <id>exec-npm-run-tsc</id>
            <phase>generate-sources</phase>
            <configuration>                              
                <workingDirectory>${project.basedir}src\main\app</workingDirectory>
                <executable>npm</executable>
                <arguments>
                    <argument>run</argument>
                    <argument>tsc</argument>
                </arguments>
            </configuration>
            <goals>
                <goal>exec</goal>
                </goals>
        </execution>
    </executions>
</plugin>

0 个答案:

没有答案