Maven-Plugin:无法运行任务'yarn'

时间:2017-10-20 08:12:42

标签: java node.js maven

构建项目并运行frontend-maven-plugin会导致运行任务失败。

规格:

  • Node.js 6.11.4
  • npm 3.10.10
  • 纱线1.2.1
  • Maven 3.3.9(3.5.0)
  • 操作系统:Windows 10 64位和Ubuntu 16.10

这就是日志的样子:

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.3:yarn (frontend: execute yarn install) on project zanata-frontend: Failed to run task: 'yarn ' failed. (error code 1) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.3:yarn (frontend: execute yarn install) on project zanata-frontend: Failed to run task
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at io.takari.maven.builder.smart.SmartBuilderImpl.buildProject(SmartBuilderImpl.java:334)
        at io.takari.maven.builder.smart.SmartBuilderImpl$ProjectBuildTask.run(SmartBuilderImpl.java:104)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.MojoFailureException: Failed to run task
        at com.github.eirslett.maven.plugins.frontend.mojo.AbstractFrontendMojo.execute(AbstractFrontendMojo.java:95)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 10 more
Caused by: com.github.eirslett.maven.plugins.frontend.lib.TaskRunnerException: 'yarn ' failed. (error code 1)
        at com.github.eirslett.maven.plugins.frontend.lib.YarnTaskExecutor.execute(YarnTaskExecutor.java:61)
        at com.github.eirslett.maven.plugins.frontend.mojo.YarnMojo.execute(YarnMojo.java:65)
        at com.github.eirslett.maven.plugins.frontend.mojo.AbstractFrontendMojo.execute(AbstractFrontendMojo.java:89)
        ... 12 more
[ERROR]
[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/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :zanata-frontend

frontend maven插件:

          <plugin>
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <executions>
          <!-- Download all dependency modules from yarn (or mirror). -->
          <execution>
            <id>frontend: execute yarn install</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>yarn</goal>
            </goals>
            <configuration>
              <workingDirectory>${frontend.build.directory}</workingDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>

1 个答案:

答案 0 :(得分:4)

有同样的问题。将frontend-maven-plugin从1.6升级到1.4为我解决了这个问题。真的不知道潜在的问题。试一试。