#*
* 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.
*#
Checking a project's version against older releases
* Basic example
In order to check your project's version against an older release, you must add the enforcer rule as a dependency to
the maven-enforcer-plugin and then configure your the maven-enforcer-plugin to run the rule.
By default current artifact will be checked against most recently released version (retrieved from either local or one of configured remote repositories).
---
...
...
...
maven-enforcer-plugin
1.0-beta-1
...
...
${project.groupId}
${project.artifactId}
${project.version}
...
...
....
check-version
verify
enforce
...
...
...
...
...
---
* Checking against a specific released version
You can check your project against a specific released version:
---
...
...
...
maven-enforcer-plugin
1.0-beta-1
...
...
${project.groupId}
${project.artifactId}
${project.version}
...
...
....
check-version
verify
enforce
...
1.0.0
...
...
...
...
...
...
---
* Including classes
By default all classes will be considered during checking process. You might want to only check a subset of classes/packages. This is achieved by specifying <<>>.
---
...
...
...
maven-enforcer-plugin
1.0-beta-1
...
...
${project.groupId}
${project.artifactId}
${project.version}
...
...
....
check-version
verify
enforce
...
org.project.MyClass
...
...
...
...
...
...
---
We can specify multiple classes or packages. For example, to include <<>> class and <<>> package you would use a configuration like:
---
...
...
...
maven-enforcer-plugin
1.0-beta-1
...
...
${project.groupId}
${project.artifactId}
${project.version}
...
...
....
check-version
verify
enforce
...
org.project.MyClass
org.project.internal
...
...
...
...
...
...
---
* Excluding classes
You may also want to exclude some classes/packages. For instance internal code might evolve independently from published API. This is achieved by specifying <<>>.
---
...
...
...
maven-enforcer-plugin
1.0-beta-1
...
...
${project.groupId}
${project.artifactId}
${project.version}
...
...
....
check-version
verify
enforce
...
org.project.MyClass
...
...
...
...
...
...
---