The only thing you can do is use the maven checkstyle plugin . You can configure the rule and make the assembly unsuccessful if it does not comply with these rules.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <configuration> <configLocation>my-checkstyle.xml</configLocation> </configuration> </plugin>
maven.checkstyle.fail.on.violation configuration maven.checkstyle.fail.on.violation .
Then mvn checkstyle:check . Or configure it to be executed in the phase of your choice (compilation or technological resources), adding to the plugin configuration:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <executions> <execution> <id>TODEL</id> <configuration> <configLocation>my-checkstyle.xml</configLocation> </configuration> <goals> <goal>check</goal> </goals> <phase>validate</phase> </execution> </executions> </plugin>
Additional information: http://maven.apache.org/plugins/maven-checkstyle-plugin
source share