You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2020/07/27 14:26:19 UTC
[maven-enforcer] 02/02: Changed those lines reviewed in the PR.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git
commit 0124c6227829e1661a455f65b3ad474cef182933
Author: Gabriel Belingueres <be...@gmail.com>
AuthorDate: Mon May 25 16:18:56 2020 -0300
Changed those lines reviewed in the PR.
- pom.xml indentation to 2 spaces.
- 'will fail' to 'fails'.
- parameter name from 'arg0' to 'rule'.
- rewrite paragraph about parameter in pom.xml.
---
enforcer-api/src/custom-rule-sample/pom.xml | 76 +++++++++++----------
.../apache/maven/enforcer/rule/MyCustomRule.java | 4 +-
.../src/site/apt/writing-a-custom-rule.apt.vm | 78 +++++++++++-----------
3 files changed, 80 insertions(+), 78 deletions(-)
diff --git a/enforcer-api/src/custom-rule-sample/pom.xml b/enforcer-api/src/custom-rule-sample/pom.xml
index 577dac0..2b13b0a 100644
--- a/enforcer-api/src/custom-rule-sample/pom.xml
+++ b/enforcer-api/src/custom-rule-sample/pom.xml
@@ -18,41 +18,43 @@
* under the License.
*
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>custom-rule</groupId>
- <artifactId>custom-rule-sample</artifactId>
- <packaging>jar</packaging>
- <version>1.0</version>
- <name>My Custom Rule</name>
- <description>This is my custom rule.</description>
- <properties>
- <api.version>${project.version}</api.version>
- <maven.version>3.0</maven.version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.enforcer</groupId>
- <artifactId>enforcer-api</artifactId>
- <version>${api.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-core</artifactId>
- <version>${maven.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>${maven.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- </build>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>custom-rule</groupId>
+ <artifactId>custom-rule-sample</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0</version>
+ <name>My Custom Rule</name>
+ <description>This is my custom rule.</description>
+ <properties>
+ <api.version>${project.version}</api.version>
+ <maven.version>3.0</maven.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.enforcer</groupId>
+ <artifactId>enforcer-api</artifactId>
+ <version>${api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>${maven.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>${maven.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ </build>
</project>
\ No newline at end of file
diff --git a/enforcer-api/src/custom-rule-sample/src/main/java/org/apache/maven/enforcer/rule/MyCustomRule.java b/enforcer-api/src/custom-rule-sample/src/main/java/org/apache/maven/enforcer/rule/MyCustomRule.java
index 30b4db6..9b8f2fc 100644
--- a/enforcer-api/src/custom-rule-sample/src/main/java/org/apache/maven/enforcer/rule/MyCustomRule.java
+++ b/enforcer-api/src/custom-rule-sample/src/main/java/org/apache/maven/enforcer/rule/MyCustomRule.java
@@ -37,7 +37,7 @@ public class MyCustomRule
implements EnforcerRule
{
/**
- * Simple param. This rule will fail if the value is true.
+ * Simple param. This rule fails if the value is true.
*/
private boolean shouldIfail = false;
@@ -113,7 +113,7 @@ public class MyCustomRule
* by the helper need to be queried. You may for example, store certain objects in your rule
* and then query them later.
*/
- public boolean isResultValid( EnforcerRule arg0 )
+ public boolean isResultValid( EnforcerRule rule )
{
return false;
}
diff --git a/enforcer-api/src/site/apt/writing-a-custom-rule.apt.vm b/enforcer-api/src/site/apt/writing-a-custom-rule.apt.vm
index 23b5f67..e4e79d0 100644
--- a/enforcer-api/src/site/apt/writing-a-custom-rule.apt.vm
+++ b/enforcer-api/src/site/apt/writing-a-custom-rule.apt.vm
@@ -34,48 +34,48 @@ Writing a custom rule
+---+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>custom-rule</groupId>
- <artifactId>custom-rule-sample</artifactId>
- <packaging>jar</packaging>
- <version>1.0</version>
- <name>My Custom Rule</name>
- <description>This is my custom rule.</description>
- <properties>
- <api.version>${project.version}</api.version>
- <maven.version>3.0</maven.version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.enforcer</groupId>
- <artifactId>enforcer-api</artifactId>
- <version>${api.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-core</artifactId>
- <version>${maven.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>${maven.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- </build>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>custom-rule</groupId>
+ <artifactId>custom-rule-sample</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0</version>
+ <name>My Custom Rule</name>
+ <description>This is my custom rule.</description>
+ <properties>
+ <api.version>${project.version}</api.version>
+ <maven.version>3.0</maven.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.enforcer</groupId>
+ <artifactId>enforcer-api</artifactId>
+ <version>${api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>${maven.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>${maven.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ </build>
</project>
+---+
[[2]] Create your rule class. The rule must implement the {{{./apidocs/index.html}EnforcerRule}} interface.
The rule can get access to components and the log via the {{{./apidocs/index.html}EnforcerRuleHelper}} interface.
- In addition, the rule must provide a setter method for each parameter allowed to be configured in the pom.xml file (like the shown in point 5).
+ In addition, the rule must provide a setter method for each parameter allowed to be configured in the pom.xml file (like the parameter <<<shouldIfail>>> shown in point 5).
If the rule succeeds, it should just simply return. If the rule fails, it should throw an {{{./apidocs/index.html}EnforcerRuleException}} with a descriptive message telling the user why the rule failed.
@@ -104,7 +104,7 @@ public class MyCustomRule
implements EnforcerRule
{
/**
- * Simple param. This rule will fail if the value is true.
+ * Simple param. This rule fails if the value is true.
*/
private boolean shouldIfail = false;
@@ -180,7 +180,7 @@ public class MyCustomRule
* by the helper need to be queried. You may for example, store certain objects in your rule
* and then query them later.
*/
- public boolean isResultValid( EnforcerRule arg0 )
+ public boolean isResultValid( EnforcerRule rule )
{
return false;
}