![](/img/trans.png)
[英]Problem with Maven plugin :maven-enforcer-plugin:3.0.0-M3:enforce Some Enforcer rules have failed
[英]Maven Enforcer - Is it possible to have a custom rule with an array property?
我遇到有关我的强制实施程序自定义规则的配置的问题。
我的POM文件中的插件配置如下所示:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3.1</version>
<executions>
<execution>
<id>enforce</id>
<phase>validate</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<uTF8Rule implementation="com.mavenrules.utf8validator.UTF8Rule">
<validationPath>${basedir}</validationPath>
</uTF8Rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
已在父POM中声明了对规则的依赖关系。
我想要的是能够指定路径列表/数组作为“ uTF8Rule”的属性,而不仅仅是一个简单的变量。 ( 我希望POM负责应用规则的路径,而不是将规则配置为在我的basedir内部搜索各种路径 )
我找不到有关规则属性类型的引用/文档。
所需的输出如下所示:
<configuration>
<rules>
<uTF8Rule implementation="com.mavenrules.utf8validator.UTF8Rule">
<listOfPaths>
<path1>xxx</path1>
<path2>yyy</path2>
</listOfPaths>
</uTF8Rule>
</rules>
</configuration>
任何想法都欢迎。
提前致谢!
配置中的对象遵循JavaBean / pojo约定。 因此,在这种情况下:
public class com.mavenrules.utf8validator.UTF8Rule {
private List<String> listOfPaths; // or String[]
}
这应该已经足够了,但是有点没用。 通过添加getter和setter,您应该没事。 如果我没打错,某些版本在启动List或数组时会遇到麻烦,但是您也可以自己做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.