aboutsummaryrefslogtreecommitdiffstats
path: root/enforcer-rule/src/site/apt/usage.apt.vm
blob: 8bc37aebcb21a24be035b197a3427b5070b5f733 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#*
 * This software is licensed under the Apache 2 license, quoted below.
 *
 * Copyright 2010 Julien Eluard
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 *     [http://www.apache.org/licenses/LICENSE-2.0]
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 *#

Usage

  The enforcer rule offers a rule for checking project's version against a previously released artifact.

* Basic Usage

** Checking a project's version

  In order to check your project's version, you must add the enforcer rule as a dependency to
  the maven-enforcer-plugin and then configure the maven-enforcer-plugin to run the rule:

---
<project>
  ...
  <build>
    ...
    <plugins>
      ...
      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>1.0-beta-1</version>
        ...
        <dependencies>
            ...
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>${project.artifactId}</artifactId>
                <version>${project.version}</version>
            </dependency>
            ...
        </dependencies>
        ...
        <executions>
           ....
          <execution>
            <id>check</id>
            <phase>verify</phase>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <checkVersionRule implementation="org.semver.enforcer.CheckVersionnRule">
                  ...
                  <previousVersion>1.0.0</previousVersion>
                  ...
                </checkVersionrule>
              </rules>
            </configuration>
          </execution>
          ...
        </executions>
        ...
      </plugin>
      ...
    </plugins>
    ...
  </build>
  ...
</project>
---

  Once you have configured your project with details of the previous version to check, maven-enforcer will be able to
  throw a build error if current version is not backward compatible with previous one. 

  Some more detailed {{{./examples/checking-version.html}examples}} of the <<<checkVersionRule>>> rule.