exec-maven-plugin插件错误 [英] exec-maven-plugin plugin error
问题描述
我按如下所示使用exec-maven-plugin
I use the exec-maven-plugin as follow
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<version>1.6.0</version>
<executions>
<execution>
<id>npm install</id>
<goals>
<goal>exec</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<executable>${npm.executable}</executable>
<arguments>
<argument>install</argument>
</arguments>
<workingDirectory>${basedir}/target/angular5/tourism</workingDirectory>
<target>
<echo message="Npm install" />
</target>
</configuration>
</execution>
</executions>
</plugin>
我遇到以下错误
java.io.IOException: Cannot run program "npm" (in directory "/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/angular5/tourism"): error=2, No such file or directory
但是目录"/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/angular5/tourism"存在,命令npm install可以在控制台的该目录中使用.我已经安装了Apache Maven 3.5.4并使用eclipse
However the directory "/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/angular5/tourism" exists and the command npm install works in this directory in the console. I have the Apache Maven 3.5.4 installed and use eclipse
推荐答案
首先,您应该按照我在下面的评论中提到的那样编辑您的问题.
First, you should edit your question as I mentionned in comments below.
然后,我认为您误解了该错误.实际上,该错误表明在目录"/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/angular5/tourism
中找不到npm
.
Then, I think you misunderstood the error. In fact, the error indicates that npm
is not found inside your directory "/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/angular5/tourism
.
这是正常现象. npm
位于PATH
中,这就是为什么您可以成功运行npm install
的原因.
And this is normal. npm
is in your PATH
that's why you can run npm install
successfully.
我建议您对npm命令使用 Maven插件:
I recommand you to use a Maven plugin for npm commands:
- frontend-maven-plugin
- npm-maven-plugin
这篇关于exec-maven-plugin插件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!