~ubuntu-branches/ubuntu/utopic/maven-enforcer/utopic

« back to all changes in this revision

Viewing changes to enforcer-rules/src/site/apt/requireProperty.apt

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2011-09-12 22:30:16 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: package-import@ubuntu.com-20110912223016-hrf239vjs4g4pik3
Tags: upstream-1.0
ImportĀ upstreamĀ versionĀ 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
  Require Property
20
 
  ------
21
 
  Brian Fox
22
 
  ------
23
 
  June 2007
24
 
  ------
25
 
 
26
 
Require Property
27
 
 
28
 
  This rule can enforce that a declared property is set and optionally evaluate it against a regular expression.
29
 
 
30
 
 
31
 
   The following parameters are supported by this rule:
32
 
   
33
 
   * property - the property to evaluate.
34
 
   
35
 
   * message - an optional message to the user if the rule fails. Default is: "Property 'xxx' is required for this build".      
36
 
   
37
 
   * regex - a regular expression used to check the value of the property.
38
 
   
39
 
   * regexMessage - an optional message to the user if the regex check fails.
40
 
   
41
 
   []
42
 
 
43
 
  Sample Plugin Configuration:
44
 
  
45
 
+---+
46
 
<project>
47
 
  [...]
48
 
  <build>
49
 
    <plugins>
50
 
      <plugin>
51
 
        <groupId>org.apache.maven.plugins</groupId>
52
 
        <artifactId>maven-enforcer-plugin</artifactId>
53
 
        <version>1.0</version>
54
 
        <executions>
55
 
          <execution>
56
 
            <id>enforce-property</id>
57
 
            <goals>
58
 
              <goal>enforce</goal>
59
 
            </goals>
60
 
            <configuration>
61
 
              <rules>
62
 
                <requireProperty>
63
 
                  <property>basedir</property>
64
 
                  <message>"You must have a basedir!"</message>
65
 
                  <regex>"\d"</regex>
66
 
                  <regexMessage>"You must have a digit in your baseDir!"</regexMessage>
67
 
                </requireProperty>
68
 
              </rules>
69
 
              <fail>true</fail>
70
 
            </configuration>
71
 
          </execution>
72
 
        </executions>
73
 
      </plugin>
74
 
    </plugins>
75
 
  </build>
76
 
  [...]
77
 
</project>
78
 
+---+
79