在ANT脚本中集成NPM内部版本

时间:2018-04-23 10:09:01

标签: npm ant

我有一个现有的 ANT 文件来构建java代码。我需要在构建中集成以下命令:

1) npm install

2) npm run build

我如何整合它?

我相信我需要添加一个新目标来运行这些命令,但不确定确切的代码/ xml更改。

1 个答案:

答案 0 :(得分:1)

<target name="npm-install">
        <exec dir="./web/public" executable="cmd.exe" output="npm-install.txt">
         <arg line="/c npm install"/>
        </exec>
</target>

<target name="npm-build">
    <exec dir="./web/public" executable="cmd.exe" output="npm-build.txt">
     <arg line="/c npm run build"/>
    </exec>
</target>