SpringMVC+Angular2.0:编译时利用Maven来执行npm相关命令

网上有一个maven插件是可以做到的:frontend-maven-plugin ,但在win10+jdk1.8的环境上执行失败,一直报node不是有效的win32位程序,换node x86和x64都不可以。

网上的原因是由于npm是cmd文件,不是exe文件,找工具转成exe后依然失败。

最后还是在exec上找切入点,终于在stackoverflow上找到原因:

The reason why you can’t run it is because it’s not an executable, it’s a batch file or shell script if you’re not on windows.
You can still use maven exec plugin to run it. However to do that you’ll have to feed the batch file npm to cmd
program (or bash or whatever is your favorite shell).

Following is the change that you’ll need to make.

Actual command to feed batch to cmd

Following is the change in the plugin configuration.

 

所以真正可用的pom.xml 配置是:

 

Comments

So empty here ... leave a comment!

发表评论

电子邮件地址不会被公开。 必填项已用*标注

Sidebar