gpt4 book ai didi

node.js - Maven 前端构建在生成源阶段运行两次

转载 作者:太空宇宙 更新时间:2023-11-03 21:57:14 25 4
gpt4 key购买 nike

我的 POM 文件包含构建前端版本的插件。但是,当我们运行 mvn clean install 时,它会运行前端 grunt/npm exec 两次。如何避免多次执行?

感谢所有帮助。由于 grunt 构建需要时间,因此删除重复的运行将缩短构建时间。

    <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<id>exec-npm-install</id>
<phase>generate-sources</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
<workingDirectory>src/main/raw_ui</workingDirectory>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
<execution>
<id>exec-bower-install</id>
<phase>generate-sources</phase>
<configuration>
<executable>bower</executable>
<arguments>
<argument>install</argument>
</arguments>
<workingDirectory>src/main/raw_ui</workingDirectory>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
<execution>
<id>exec-grunt</id>
<phase>generate-sources</phase>
<configuration>
<executable>grunt</executable>
<arguments>
<argument>build</argument>
<argument>-f</argument>
</arguments>
<workingDirectory>src/main/raw_ui</workingDirectory>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>

最佳答案

我真的不知道为什么这可以解决问题,但是在将阶段从“生成源”更改为“进程类”之后,它现在只运行一次。

我在这里找到:Maven plugin executes multiple times during build某些目标可以执行某些生命周期,这就是为什么我尝试更改阶段来运行 Node 脚本。

关于node.js - Maven 前端构建在生成源阶段运行两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37574934/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com