User Guide
Usage
Please see the generated plugin documentation for a reference of all the configuration options.
Basic usage
- Add http://download.java.net/maven/2 to the plugin repositories of your pom.xml
- Configure the plugin in project/build/plugins.
<pluginRepositories> ... <pluginRepository> <id>maven2-repository.dev.java.net</id> <url>http://download.java.net/maven/2</url> <layout>default</layout> </pluginRepository> </pluginRepositories> ... <build> <plugins> <plugin> <groupId>org.jvnet.mcvp</groupId> <artifactId>maven-css-validator-plugin</artifactId> <executions> <execution> <goals> <goal>validate</goal> </goals> <configuration> <!-- CSS Profile (css21 is default) --> <profile>css21</profile> <!-- Included CSS files (src/main/webapp/**/*.css is default) --> <includes> <include>src/main/resources/**/*.css</include> <include>src/main/webapp/**/*.css</include> </includes> </configuration> </execution> </executions> </plugin> </plugins> </build>
You'll get a report like one below:
[INFO] [css-validator:validate {execution: default}]
[ERROR] Found [3] errors.
[ERROR] Location: .../style.css
[ERROR] Line: 375 .ControlLegendContainer
[ERROR] Value Error: border-top (http://www.w3.org/TR/CSS21/box.html#propdef-border-top)
[ERROR] grey is not a color value : 1px solid grey
[ERROR] Line: 380 .ControlLegendPluginLayer
[ERROR] Value Error: border-bottom (http://www.w3.org/TR/CSS21/box.html#propdef-border-bottom)
[ERROR] grey is not a color value : 1px solid grey
[ERROR] Line: 446 .ControlLegendPluginLayerVisibilityInput
[ERROR] Value Error: padding (http://www.w3.org/TR/CSS21/box.html#propdef-padding)
[ERROR] Parse Error
[ERROR] CSS files were validated with [3] errors.
Ignoring CSS validation failures
By default, if your CSS files have errors, Maven CSS Validator Plugin will make your build fail. In some cases you may want to avoid this. There are two way to do this.
First, you may use a command-line option:
mvn clean install -Dmaven.cssValidation.failure.ignore=true
Second, you may use the cssValidationFailureIgnore configuration option:
<build> <plugins> <plugin> <groupId>org.jvnet.mcvp</groupId> <artifactId>maven-css-validator-plugin</artifactId> <configuration> <cssValidationFailureIgnore>true</cssValidationFailureIgnore> </configuration> </plugin> </plugins> </build>