diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractPropertyEnforcerRule.java b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractPropertyEnforcerRule.java index fade2a21..2045b0cc 100755 --- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractPropertyEnforcerRule.java +++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractPropertyEnforcerRule.java @@ -123,13 +123,16 @@ public void execute( EnforcerRuleHelper helper ) /** * How the property that is being evaluated is called + * @return kind of property */ - public abstract String getName(); + protected abstract String getName(); /** - * The name of the property currently being evaluated, this is used for default message pourpouses only + * The name of the property currently being evaluated, this is used for default message purposes only + * + * @return the name of the property */ - public abstract String getPropertyName(); + protected abstract String getPropertyName(); /** * Resolves the property value @@ -137,7 +140,7 @@ public void execute( EnforcerRuleHelper helper ) * @param helper * @throws EnforcerRuleException */ - public abstract Object resolveValue( EnforcerRuleHelper helper ) + protected abstract Object resolveValue( EnforcerRuleHelper helper ) throws EnforcerRuleException; } diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireJavaVendor.java b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireJavaVendor.java index 64c78028..172ee686 100644 --- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireJavaVendor.java +++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireJavaVendor.java @@ -73,11 +73,7 @@ else if ( includes != null && !includes.contains( SystemUtils.JAVA_VENDOR ) ) * java.vendor, which you can also see with mvn --version.
* Excludes override the include rules. * - * Some examples are: - * + * @param theExcludes the vendor to to exclude from the include list. */ public void setExcludes( List theExcludes ) { @@ -90,7 +86,15 @@ public void setExcludes( List theExcludes ) * The rule will fail if vendor name matches any exclude, unless it also matches an * include rule. * - * @see #setIncludes(List) + * Some examples are: + * + * + * @param theIncludes the list of required vendors. + * + * @see #setExcludes(List) */ public void setIncludes( List theIncludes ) { diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/ArtifactMatcher.java b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/ArtifactMatcher.java index ff5803b7..38175696 100644 --- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/ArtifactMatcher.java +++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/ArtifactMatcher.java @@ -162,7 +162,9 @@ public String toString() /** * Construct class by providing patterns as strings. Empty strings are ignored. - * + * + * @param patterns includes + * @param ignorePatterns excludes * @throws NullPointerException if any of the arguments is null */ public ArtifactMatcher( final Collection patterns, final Collection ignorePatterns ) @@ -195,7 +197,10 @@ public ArtifactMatcher( final Collection patterns, final Collection addAll( List p } /** + * Whether the version is coming from the default lifecycle bindings. + * Cannot be determined before Maven 3.6.1 * * @param o either Plugin or ReportPlugin - * @return + * @return null if untraceable, otherwise its matching value + * @see MNG-6600 */ public static Optional isVersionFromDefaultLifecycleBindings( InputLocationTracker o ) { @@ -93,9 +96,12 @@ public static Optional isVersionFromDefaultLifecycleBindings( InputLoca } /** + * Whether the version is coming from the super POM. + * Cannot be determined before Maven 3.6.1 * * @param o either Plugin or ReportPlugin - * @return null if untraceable, otherwise its matching value + * @return null if untraceable, otherwise its matching value + * @see MNG-6593 */ public static Optional isVersionFromSuperpom( InputLocationTracker o ) { diff --git a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/BanDistributionManagementTest.java b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/BanDistributionManagementTest.java index c1af1741..2c379e5c 100644 --- a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/BanDistributionManagementTest.java +++ b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/BanDistributionManagementTest.java @@ -62,7 +62,7 @@ public void shouldNotFailWithoutDistributionManagement() * </distributionManagement> * * - * @throws Exception + * @throws Exception if any occurs */ @Test( expected = EnforcerRuleException.class ) public void shouldThrowExceptionIfDistributionManagementIsDefinedWithRepository() @@ -85,6 +85,8 @@ public void shouldThrowExceptionIfDistributionManagementIsDefinedWithRepository( * </snapshotRepository> * </distributionManagement> * + * + * @throws Exception if any occurs */ @Test( expected = EnforcerRuleException.class ) public void shouldThrowExceptionIfDistributionManagementIsDefinedWithRepositorySnapshotRepository() @@ -110,6 +112,8 @@ public void shouldThrowExceptionIfDistributionManagementIsDefinedWithRepositoryS * </site> * </distributionManagement> * + * + * @throws Exception if any occurs */ @Test( expected = EnforcerRuleException.class ) public void shouldThrowExceptionIfDistributionManagementIsDefinedWithRepositorySnapshotRepositorySite() @@ -130,6 +134,8 @@ public void shouldThrowExceptionIfDistributionManagementIsDefinedWithRepositoryS * </repository> * </distributionManagement> * + * + * @throws Exception if any occurs */ @Test public void shouldAllowDistributionManagementHavingRepository() @@ -153,6 +159,8 @@ public void shouldAllowDistributionManagementHavingRepository() * </snapshotRepository> * </distributionManagement> * + * + * @throws Exception if any occurs */ @Test public void shouldAllowDistributionManagementHavingRepositorySnapshotRepository() @@ -180,6 +188,8 @@ public void shouldAllowDistributionManagementHavingRepositorySnapshotRepository( * </site> * </distributionManagement> * + * + * @throws Exception if any occurs */ @Test public void shouldAllowDistributionManagementHavingRepositorySnapshotRepositorySite() diff --git a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestEvaluateBeanshell.java b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestEvaluateBeanshell.java index f78729f1..62c6528c 100644 --- a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestEvaluateBeanshell.java +++ b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestEvaluateBeanshell.java @@ -53,9 +53,10 @@ public void setUp() /** * Test rule. + * */ public void testRulePass() - throws EnforcerRuleException, ExpressionEvaluationException + throws Exception { EvaluateBeanshell rule = new EvaluateBeanshell(); // this property should not be set @@ -67,7 +68,7 @@ public void testRulePass() } public void testRuleFail() - throws EnforcerRuleException, ExpressionEvaluationException + throws Exception { EvaluateBeanshell rule = new EvaluateBeanshell(); // this property should be set by the surefire @@ -88,7 +89,7 @@ public void testRuleFail() } public void testRuleFailNoMessage() - throws EnforcerRuleException, ExpressionEvaluationException + throws Exception { EvaluateBeanshell rule = new EvaluateBeanshell(); // this property should be set by the surefire @@ -108,7 +109,7 @@ public void testRuleFailNoMessage() } public void testRuleInvalidExpression() - throws EnforcerRuleException, ExpressionEvaluationException + throws Exception { EvaluateBeanshell rule = new EvaluateBeanshell(); rule.setCondition( "${env} == null" ); @@ -129,7 +130,7 @@ public void testRuleInvalidExpression() } public void testRuleInvalidBeanshell() - throws EnforcerRuleException, ExpressionEvaluationException + throws Exception { EvaluateBeanshell rule = new EvaluateBeanshell(); rule.setCondition( "this is not valid beanshell" ); @@ -147,7 +148,7 @@ public void testRuleInvalidBeanshell() } - public void testRuleCanExecuteMultipleThreads() throws InterruptedException { + public void testRuleCanExecuteMultipleThreads() throws Exception { final String condition = "String property1 = \"${property1}\";\n" + "(property1.equals(\"prop0\") && \"${property2}\".equals(\"prop0\"))\n" + "|| (property1.equals(\"prop1\") && \"${property2}\".equals(\"prop1\"))\n" + diff --git a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireReleaseDeps.java b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireReleaseDeps.java index fa4ae75b..84030ae3 100644 --- a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireReleaseDeps.java +++ b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireReleaseDeps.java @@ -41,7 +41,7 @@ public class TestRequireReleaseDeps /** * Test rule. * - * @throws IOException Signals that an I/O exception has occurred. + * @throws Exception if any occurs */ @Test public void testRule() @@ -105,9 +105,17 @@ public void testWildcardIgnore() throws Exception EnforcerRuleUtilsHelper.execute( rule, helper, false ); } - - + /** + * Test id. + */ + @Test + public void testId() + { + RequireReleaseDeps rule = newRequireReleaseDeps(); + rule.getCacheId(); + } + private RequireReleaseDeps newRequireReleaseDeps() { RequireReleaseDeps rule = new RequireReleaseDeps() @@ -125,14 +133,4 @@ protected Set getDependenciesToCheck( ProjectBuildingRequest buildingR }; return rule; } - - /** - * Test id. - */ - @Test - public void testId() - { - RequireReleaseDeps rule = newRequireReleaseDeps(); - rule.getCacheId(); - } } diff --git a/maven-enforcer-extension/pom.xml b/maven-enforcer-extension/pom.xml index 6f95f5b6..4d74cafc 100644 --- a/maven-enforcer-extension/pom.xml +++ b/maven-enforcer-extension/pom.xml @@ -36,6 +36,7 @@ org.eclipse.sisu sisu-maven-plugin + 0.3.4 index-project diff --git a/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java b/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java index 77fad8df..da0f258b 100644 --- a/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java +++ b/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java @@ -132,11 +132,6 @@ private boolean havingRules() return rules != null && rules.length > 0; } - /** - * Entry point to the mojo - * - * @throws MojoExecutionException - */ @Override public void execute() throws MojoExecutionException