Question

I'm facing an issue regarding the configuration of one of my enforcer custom rules.

The plugin configuration inside my POM file looks like this:

      <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>

Dependencies to the Rule have been declared in the parent POM.

What I want is to be able to specify a list/array of Paths as a property to the "uTF8Rule" instead of just a simple variable. (I want the POM to be responsible for the paths where my rule applies and not configure the rule to search various paths inside my basedir)

I was not able to find references/documentation regarding types of the rule properties.

A desired output would be something like:

<configuration>
  <rules>
    <uTF8Rule implementation="com.mavenrules.utf8validator.UTF8Rule">
       <listOfPaths>
          <path1>xxx</path1>
          <path2>yyy</path2>                
       </listOfPaths>
    </uTF8Rule>
  </rules>
</configuration>

Any idea is welcomed.

Thanks in advance!

No correct solution

OTHER TIPS

Objects within the configuration follow the JavaBean/pojo convention. So in this case:

public class com.mavenrules.utf8validator.UTF8Rule {
  private List<String> listOfPaths; // or String[]
}

This should already be enough, but is a bit useless. By adding a getter and setter you should be fine. If I call correctly some versions have trouble initiating the List or array, but that's sothing you can do yourself as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top