如果项目中不存在文件,则跳过 Maven 插件的执行
Skip execution of a maven plugin if a file does not exist in the project
我想在某个文件不存在时跳过执行插件。有办法吗?
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>${customFolder}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
用配置文件包围插件定义。
可以根据文件的 existence/non-existence 激活配置文件。
https://maven.apache.org/guides/introduction/introduction-to-profiles.html
我想在某个文件不存在时跳过执行插件。有办法吗?
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>${customFolder}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
用配置文件包围插件定义。
可以根据文件的 existence/non-existence 激活配置文件。
https://maven.apache.org/guides/introduction/introduction-to-profiles.html