如果特定目录不存在,则有条件地运行MVN插件
只有在不存在特定目录的情况下,才可以有条件地运行Maven插件吗?
我本质上是在尝试防止npm ci
不必要地作为软件包运行。因此,理想情况下,只有在不存在node_modules
时才能运行。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>npm-install</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>ci</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
Is it possible to conditionally run a maven plugin only if a specific directory doesn't exist?
I'm essentially trying to prevent npm ci
from running unnecessarily as package.json rarely changes. So ideally it would only run when node_modules
doesn't exists.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>npm-install</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>ci</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将其包装到配置文件中,并仅在不存在给定文件时激活该配置文件。
You can wrap it into a profile and activate that profile only if a given file does not exist.