我正在使用Maven构建NodeJS应用程序。我正在为此使用Maven前端插件。 Maven能够下载节点模块,但是无法在项目上执行目标org.codehaus.mojo:exec-maven-plugin:1.5.0:exec (filter-node-package)
。
这是NodeJS模块的pom文件-
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.sap.boudhayan.mtapp</groupId>
<artifactId>mtapp-parent</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>mtapp-service</artifactId>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
这是结果错误-
Filtering file node_modules/yallist/package.json
Filtering file node_modules/@sap/e2e-trace/npm-shrinkwrap.json
Filtering file node_modules/@sap/xsenv/npm-shrinkwrap.json
Deleting [ 'node', 'target' ]
fs.js:1089
return binding.unlink(pathModule._makeLong(path));
^
Error: EPERM: operation not permitted, unlink 'C:\Users\Boudhayan\Desktop\mtapp-build\mtapp\service\node\node.exe'
at Error (native)
at Object.fs.unlinkSync (fs.js:1089:18)
at fixWinEPERMSync (C:\Users\Boudhayan\Desktop\mtapp-build\mtapp\service\node\node_modules\filter-node-package\node_modules\rimraf\rimraf.js:211:13)
at rimrafSync (C:\Users\Boudhayan\Desktop\mtapp-build\mtapp\service\node\node_modules\filter-node-package\node_modules\rimraf\rimraf.js:311:28)
at C:\Users\Boudhayan\Desktop\mtapp-build\mtapp\service\node\node_modules\filter-node-package\node_modules\rimraf\rimraf.js:342:5
at Array.forEach (native)
at rmkidsSync (C:\Users\Boudhayan\Desktop\mtapp-build\mtapp\service\node\node_modules\filter-node-package\node_modules\rimraf\rimraf.js:341:26)
at rmdirSync (C:\Users\Boudhayan\Desktop\mtapp-build\mtapp\service\node\node_modules\filter-node-package\node_modules\rimraf\rimraf.js:334:7)
at fixWinEPERMSync (C:\Users\Boudhayan\Desktop\mtapp-build\mtapp\service\node\node_modules\filter-node-package\node_modules\rimraf\rimraf.js:209:5)
at Function.rimrafSync [as sync] (C:\Users\Boudhayan\Desktop\mtapp-build\mtapp\service\node\node_modules\filter-node-package\node_modules\rimraf\rimraf.js:311:28)
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:764)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:711)
at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:289)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for mtapp-parent 1.0.0:
[INFO]
[INFO] mtapp-parent ....................................... SUCCESS [ 1.415 s]
[INFO] mtapp-db ........................................... SUCCESS [02:49 min]
[INFO] mtapp-service ...................................... FAILURE [02:27 min]
[INFO] mtapp-assembly ..................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 05:19 min
[INFO] Finished at: 2019-03-21T09:59:45+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:exec (filter-node-package) on project mtapp-service: Command execution failed.: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command