Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0-alpha-3
-
Fix Version/s: 1.0-beta-1
-
Component/s: Rule API
-
Labels:None
-
Number of attachments :
Description
The documentation at http://maven.apache.org/enforcer/enforcer-api/writing-a-custom-rule.html has the wrong dependencies and code examples for creating a custom rule.
It defines
<dependency> <groupId>org.apache.maven.enforcer</groupId> <artifactId>enforcer-api</artifactId> <version>${api.version}</version> </dependency>
instead of
<dependency> <groupId>org.apache.maven.shared</groupId> <artifactId>maven-enforcer-rule-api</artifactId> <version>1.0-alpha-2</version> </dependency>
and so the code examples are incorrect because:
- Incorrect imports:
- The imports are for
- org.apache.maven.enforcer.rule.api.EnforcerRule
- org.apache.maven.enforcer.rule.api.EnforcerRuleException
- org.apache.maven.enforcer.rule.api.EnforcerRuleHelper
- instead of
- org.apache.maven.shared.enforcer.rule.api.EnforcerRule
- org.apache.maven.shared.enforcer.rule.api.EnforcerRuleException
- org.apache.maven.shared.enforcer.rule.api.EnforcerRuleHelper.
- Implementing import org.apache.maven.enforcer.rule.api.EnforcerRule causes the custom plugin invocation to fail with an ArrayStoreException as the expected type is import org.apache.maven.shared.enforcer.rule.api.EnforcerRule instead.
- The imports are for
- It shows implementing public String getCacheId(), public boolean isCacheable(), public boolean isResultValid( EnforcerRule arg0 ) which are no longer needed.
The documentation on the site is for 1.0-SNAPSHOT, which has changed GroupId / ArtifactId from version 1.0-alpha-2 to the current SNAPSHOT. So for the current version (SNAPSHOT) the site is right, but for the current alpha release it is not right.
Also the method you've mentioned are necessary in current SNAPSHOT.