Debian Codegraph @

maven-enforcer-plugin/src/site/apt/usage.apt.vm

raw
1 ~~ Licensed to the Apache Software Foundation (ASF) under one
2 ~~ or more contributor license agreements. See the NOTICE file
3 ~~ distributed with this work for additional information
4 ~~ regarding copyright ownership. The ASF licenses this file
5 ~~ to you under the Apache License, Version 2.0 (the
6 ~~ "License"); you may not use this file except in compliance
7 ~~ with the License. You may obtain a copy of the License at
8 ~~
9 ~~ http://www.apache.org/licenses/LICENSE-2.0
10 ~~
11 ~~ Unless required by applicable law or agreed to in writing,
12 ~~ software distributed under the License is distributed on an
13 ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 ~~ KIND, either express or implied. See the License for the
15 ~~ specific language governing permissions and limitations
16 ~~ under the License.
17
18 ------
19 Usage
20 ------
21 Brian Fox
22 ------
23 2007-03-01
24 ------
25
26 Usage
27
28 Brief examples on how to use the enforcer goals.
29
30 * Generic Plugin configuration information
31
32 See the following links for information about including and configuring plugins in your project:
33
34 *{{{/guides/mini/guide-configuring-plugins.html}Configuring Plugins}}
35
36 *{{{/guides/plugin/guide-java-plugin-development.html}Plugin Development}}
37
38 *{{{/guides/introduction/introduction-to-plugin-prefix-mapping.html}Plugin Prefix}}
39
40 []
41
42 * The <<<enforcer:enforce>>> mojo
43
44 This goal is meant to be bound to a lifecycle phase and configured in your
45 <<<pom.xml>>>. The enforcers execute the configured rules to check for certain constraints.
46 The available built-in rules are described {{{../enforcer-rules/index.html}here}}. Besides the rules to execute, these goals support three options:
47
48 * {{{./enforce-mojo.html#skip}skip}} - a quick way to skip checks via a profile or using <<<-Denforcer.skip>>> from the command line.
49
50 * {{{./enforce-mojo.html#fail}fail}} - if the goal should fail the build when a rule fails. The default is <<<true>>>. If false, the errors will be logged as warnings.
51
52 * {{{./enforce-mojo.html#failFast}failFast}} - if the goal should stop checking after the first failure. The default is <<<false>>>.
53
54 []
55
56 Each rule to be executed should be added to the rules element along with the specific configuration for that rule.
57
58 As of version 1.4, you may add a <<<level>>> element to the rules. Valid values are <<<WARN>>> and <<<ERROR>>>. When
59 <<<level>>> <<<WARN>>> is specified, the rule will only spit out a warning but will not fail the build.
60
61
62 Sample Plugin Configuration:
63
64 +---+
65 <project>
66 [...]
67 <build>
68 <plugins>
69 <plugin>
70 <groupId>org.apache.maven.plugins</groupId>
71 <artifactId>maven-enforcer-plugin</artifactId>
72 <version>${project.version}</version>
73 <executions>
74 <execution>
75 <id>enforce-versions</id>
76 <goals>
77 <goal>enforce</goal>
78 </goals>
79 <configuration>
80 <rules>
81 <bannedPlugins>
82 <!-- will only display a warning but does not fail the build. -->
83 <level>WARN</level>
84 <excludes>
85 <exclude>org.apache.maven.plugins:maven-verifier-plugin</exclude>
86 </excludes>
87 <message>Please consider using the maven-invoker-plugin (http://maven.apache.org/plugins/maven-invoker-plugin/)!</message>
88 </bannedPlugins>
89 <requireMavenVersion>
90 <version>2.0.6</version>
91 </requireMavenVersion>
92 <requireJavaVersion>
93 <version>1.5</version>
94 </requireJavaVersion>
95 <requireOS>
96 <family>unix</family>
97 </requireOS>
98 </rules>
99 </configuration>
100 </execution>
101 </executions>
102 </plugin>
103 </plugins>
104 </build>
105 [...]
106 </project>
107 +---+
108