Java Maven Enforcer-是否可以使用数组属性创建自定义规则?
我面临一个关于我的一个enforcer自定义规则配置的问题 我的POM文件中的插件配置如下所示:Java Maven Enforcer-是否可以使用数组属性创建自定义规则?,java,maven,maven-3,maven-plugin,maven-enforcer-plugin,Java,Maven,Maven 3,Maven Plugin,Maven Enforcer Plugin,我面临一个关于我的一个enforcer自定义规则配置的问题 我的POM文件中的插件配置如下所示: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <version>1.3.1</version>
<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>
org.apache.maven.plugins
maven enforcer插件
1.3.1
执行
验证
执行
${basedir}
已在父POM中声明对规则的依赖关系
我想要的是能够将路径列表/数组指定为“uTF8Rule”的属性,而不仅仅是一个简单的变量。(我希望POM负责我的规则适用的路径,而不是将规则配置为搜索我的basedir中的各种路径)
我找不到关于规则属性类型的引用/文档
所需的输出类似于:
<configuration>
<rules>
<uTF8Rule implementation="com.mavenrules.utf8validator.UTF8Rule">
<listOfPaths>
<path1>xxx</path1>
<path2>yyy</path2>
</listOfPaths>
</uTF8Rule>
</rules>
</configuration>
xxx
yyy
任何想法都欢迎
提前谢谢 配置中的对象遵循JavaBean/pojo约定。 因此,在这种情况下:
public class com.mavenrules.utf8validator.UTF8Rule {
private List<String> listOfPaths; // or String[]
}
public class com.mavenrules.utf8validator.UTF8Rule{
私有列表ListofPath;//或字符串[]
}
这应该已经足够了,但有点无用。通过添加一个getter和setter,您应该很好。
如果我调用正确,一些版本在启动列表或数组时会遇到问题,但是你也可以自己做。配置中的对象遵循JavaBean/pojo约定。 因此,在这种情况下:
public class com.mavenrules.utf8validator.UTF8Rule {
private List<String> listOfPaths; // or String[]
}
public class com.mavenrules.utf8validator.UTF8Rule{
私有列表ListofPath;//或字符串[]
}
这应该已经足够了,但有点无用。通过添加一个getter和setter,您应该很好。
如果我调用正确,一些版本在启动列表或数组时会遇到问题,但是你也可以自己做