Hi,

I'd recommend you to use the fronend-maven-plugin [1] for your use case.
This plugin installs and configures npm for you, so your build is
regardless of external tools.


Best regards,

Sandra

[1]https://github.com/eirslett/frontend-maven-plugin




Am 29.01.2018 um 22:02 schrieb yossi balan:
> Hi
> 
> I tried to use the plugin and run npm install from java application
> 
> <plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>exec-maven-plugin</artifactId>
> <version>1.6.0</version>
> <executions>
> <!--node modules are in the project. no need for npm install-->
> <execution>
> <id>npm install (initialize)</id>
> <goals>
> <goal>exec</goal>
> </goals>
> <phase>initialize</phase>
> <configuration>
> <executable>npm</executable>
> <workingDirectory>${project.basedir}/../</workingDirectory>
> <arguments>
> <argument>install</argument>
> </arguments>
> </configuration>
> </execution>
> </executions>
> </plugin>
> 
> when I run mvn build I got error
> 
> [INFO] --- exec-maven-plugin:1.6.0:exec (npm install mynpm) @ srv ---
> 10:37:31 PM  npm ERR! <head><title>...'
> 
> npm ERR! A complete log of this run can be found in:
> npm ERR!
>  
> /home/vcap/app/META-INF/cache/8.9.1/.npm/_logs/2018-01-29T20_37_30_159Z-debug.log
> [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:804)
> at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:751)
> at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:313)
> at
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
> at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
> 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
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
> at
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
> at
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
> at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
> at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
> 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)
> 
> I tried also to ladd .npmrc but it look like it didn't consider this file
> Could you please advise me ?
> 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to