【问题标题】:exec-maven-plugin plugin errorexec-maven-plugin 插件错误
【发布时间】:2018-12-25 07:29:31
【问题描述】:

我使用 exec-maven-plugin 如下

<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

【问题讨论】:

    标签: maven-3 exec-maven-plugin


    【解决方案1】:

    首先,您应该像我在下面的 cmets 中提到的那样编辑您的问题。

    那么,我认为你误解了这个错误。实际上,该错误表明在您的目录"/Users/admin/Application-Marwen/workspace/Tourism/Tourism-Web/target/angular5/tourism 中找不到npm

    这是正常的。 npm 在您的 PATH 中,这就是您可以成功运行 npm install 的原因。

    我建议您为 npm 命令使用 Maven 插件

    【讨论】:

      【解决方案2】:

      将 -PlocalNoDeploy 添加为 mvn 命令的一部分可能会解决此问题。

      【讨论】:

      • 最后我使用了 frontend-maven-plugin 并解决了我的问题。我还有一个关于 Mickaël B 评论的问题。如果我添加评论,我没有所有的编辑器选项。拥有所有编辑器选项的唯一方法是添加答案。我该如何摆脱困境?
      猜你喜欢
      • 2018-01-17
      • 2016-01-31
      • 1970-01-01
      • 2014-04-23
      • 1970-01-01
      • 2013-03-14
      • 1970-01-01
      • 2012-03-13
      • 2018-12-24
      相关资源
      最近更新 更多