java - How to override configLocation in maven checkstyle plugin? -
i want override configlocation option in maven checkstyle plugin. sample part of pom.xml :
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-checkstyle-plugin</artifactid> <executions> <execution> <goals> <goal>check</goal> </goals> </execution> </executions> <configuration> <configlocation>blahblah/checkstyle/checkstyle.xml</configlocation> <consoleoutput>true</consoleoutput> </configuration> <dependencies> <dependency> <groupid>com.example.blahblah</groupid> <artifactid>checkstyle-config</artifactid> <version>2.0.0-snapshot</version> </dependency> </dependencies> <configuration> <configlocation>checkstyle.config.xml</configlocation> <suppressionslocation>checkstyle.suppressions.xml</suppressionslocation> ... other configuration ... </configuration> </plugin>
as can seen above, checkstyle-config separate maven project contains rules style check , config file use rules blahblah/checkstyle/checkstyle.xml. if have override blahblah/checkstyle/checkstyle.xml , use other .xml stored in current project , not checkstyle-config project, how can that?
you can override plugin configuration in module copying above plugin configuration part , overriding config location. in can move configuration tag within execution, that configuration applicable execution only. see below example
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-checkstyle-plugin</artifactid> <executions> <execution> <goals> <goal>check</goal> </goals> <configuration> <configlocation>blahblah/checkstyle/checkstyle.xml</configlocation> </configuration> </execution> </executions>
Comments
Post a Comment