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

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2011-09-12 22:30:16 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: package-import@ubuntu.com-20110912223016-e2pk04avoq8bur7t
Tags: 1.0-1
* Team upload
* New upstream release.
* Add more Build-Depends.

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 OS Version
20
 
  ------
21
 
  Brian Fox
22
 
  ------
23
 
  June 2007
24
 
  ------
25
 
 
26
 
Require OS Version
27
 
 
28
 
  This rule can enforce certain values about the Operating System and processor architecture. 
29
 
  The values and code used to determine if an OS is allowed are exactly the same as the OS Profile activation in Maven.
30
 
 
31
 
 
32
 
   The following parameters are supported by this rule:
33
 
 
34
 
   * message - an optional message to the user if the rule fails.
35
 
   
36
 
   * {{{../apidocs/org/apache/maven/plugin/enforcer/RequireOS.html#arch}arch}} - the cpu architecture.
37
 
   
38
 
   * {{{../apidocs/org/apache/maven/plugin/enforcer/RequireOS.html#family}family}} - the family of OS. Possible families are:
39
 
   
40
 
     * dos
41
 
  
42
 
     * mac
43
 
  
44
 
     * netware
45
 
  
46
 
     * os/2
47
 
  
48
 
     * tandem
49
 
  
50
 
     * unix
51
 
  
52
 
     * windows
53
 
  
54
 
     * win9x
55
 
  
56
 
     * z/os
57
 
  
58
 
     * os/400
59
 
     
60
 
     []
61
 
                
62
 
   
63
 
   * {{{../apidocs/org/apache/maven/plugin/enforcer/RequireOS.html#name}name}} - the name of the OS.
64
 
   
65
 
   * {{{../apidocs/org/apache/maven/plugin/enforcer/RequireOS.html#version}version}} - the version of the OS.
66
 
   
67
 
   * {{{../apidocs/org/apache/maven/plugin/enforcer/RequireOS.html#display}display}} -  flag to display the detected OS informatin.
68
 
   
69
 
   []
70
 
 
71
 
 
72
 
 Family is calculated based on testing against the name string retreived from the JDK. The name, arch and version values are retreived from the JDK using the following code:
73
 
  
74
 
+---+
75
 
    public static final String OS_NAME = System.getProperty( "os.name" ).toLowerCase( Locale.US );
76
 
 
77
 
    public static final String OS_ARCH = System.getProperty( "os.arch" ).toLowerCase( Locale.US );
78
 
 
79
 
    public static final String OS_VERSION = System.getProperty( "os.version" ).toLowerCase( Locale.US );
80
 
+---+
81
 
   
82
 
   Possible arch, name, and version values can be found here:
83
 
   
84
 
   * {{{http://lopica.sourceforge.net/os.html}lopica.sourceforge.net}}
85
 
   
86
 
   * {{{http://tolstoy.com/samizdat/sysprops.html}Sysprops}}
87
 
   
88
 
   []
89
 
     
90
 
   The various options are considered to be "and'd" together but any number can be specified. 
91
 
   (ie family = windows means windows, but family = windows and arch = x86 means only windows on x86 processors)
92
 
   
93
 
   Any parameter may also be used in the negative by prepending a "!" in front of it. For example !dos means everything but dos. (who uses dos anyway?)
94
 
   
95
 
   Since the various names, versions and architecture values cannot be listed exhaustively, there is an easy way to display the 
96
 
   information for the current system:
97
 
   
98
 
+---+
99
 
mvn enforcer:display-info
100
 
...
101
 
[enforcer:display-info]
102
 
Maven Version: 2.0.6
103
 
JDK Version: 1.5.0_11 normalized as: 1.5.0
104
 
OS Info: Arch: x86 Family: windows Name: windows xp Version: 5.1
105
 
+---+
106
 
  
107
 
  Sample Plugin Configuration:
108
 
  
109
 
+---+
110
 
<project>
111
 
  [...]
112
 
  <build>
113
 
    <plugins>
114
 
      <plugin>
115
 
        <groupId>org.apache.maven.plugins</groupId>
116
 
        <artifactId>maven-enforcer-plugin</artifactId>
117
 
        <version>1.0</version>
118
 
        <executions>
119
 
          <execution>
120
 
            <id>enforce-os</id>
121
 
            <goals>
122
 
              <goal>enforce</goal>
123
 
            </goals>
124
 
            <configuration>
125
 
              <rules>
126
 
                <requireOS>
127
 
                  <name>Windows XP</name>
128
 
                  <family>Windows</family>
129
 
                  <arch>x86</arch>
130
 
                  <version>5.1.2600</version>
131
 
                </requireOS>
132
 
              </rules>
133
 
              <fail>true</fail>
134
 
            </configuration>
135
 
          </execution>
136
 
        </executions>
137
 
      </plugin>
138
 
    </plugins>
139
 
  </build>
140
 
  [...]
141
 
</project>
142
 
+---+
143
 
  
 
 
b'\\ No newline at end of file'