You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2018/06/19 17:06:14 UTC

[maven-enforcer] branch code-improvements updated (a408f10 -> 6cf25ef)

This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a change to branch code-improvements
in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git.


 discard a408f10  Code improvements  o Removed unused class.  o Some minore improvements.
     add 94843f0  MENFORCER-142: documentation - add example for checking rules via cli
     add 389bcc1  Merge pull request #36 from sparsick/master
     new 6cf25ef  Code improvements  o Removed unused class.  o Some minore improvements.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (a408f10)
            \
             N -- N -- N   refs/heads/code-improvements (6cf25ef)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../examples/check-specific-rule-via-cli.apt.vm    | 34 ++++++++++++++++++++++
 maven-enforcer-plugin/src/site/site.xml            |  3 ++
 2 files changed, 37 insertions(+)
 create mode 100644 maven-enforcer-plugin/src/site/apt/examples/check-specific-rule-via-cli.apt.vm


[maven-enforcer] 01/01: Code improvements o Removed unused class. o Some minore improvements.

Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a commit to branch code-improvements
in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git

commit 6cf25efaabc92f59302e95ffa4b43ff8d037ef2c
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sat Jan 6 19:18:38 2018 +0100

    Code improvements
     o Removed unused class.
     o Some minore improvements.
---
 .../plugins/enforcer/ReactorModuleConvergence.java |  8 ++-
 .../plugins/enforcer/RequireMavenVersion.java      |  2 +-
 .../maven/plugins/enforcer/MockPathTranslator.java | 76 ----------------------
 3 files changed, 6 insertions(+), 80 deletions(-)

diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/ReactorModuleConvergence.java b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/ReactorModuleConvergence.java
index 1f5e6a1..55fb74a 100644
--- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/ReactorModuleConvergence.java
+++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/ReactorModuleConvergence.java
@@ -44,6 +44,8 @@ import org.codehaus.plexus.util.StringUtils;
 public class ReactorModuleConvergence
     extends AbstractNonCacheableEnforcerRule
 {
+    private static final String MODULE_TEXT = " module: ";
+
     private boolean ignoreModuleDependencies = false;
 
     private Log logger;
@@ -90,7 +92,7 @@ public class ReactorModuleConvergence
             addMessageIfExist( sb );
             for ( MavenProject mavenProject : parentsWhichAreNotPartOfTheReactor )
             {
-                sb.append( " module: " );
+                sb.append( MODULE_TEXT );
                 sb.append( mavenProject.getId() );
                 sb.append( SystemUtils.LINE_SEPARATOR );
             }
@@ -115,7 +117,7 @@ public class ReactorModuleConvergence
             addMessageIfExist( sb );
             for ( MavenProject mavenProject : modulesWithoutParentsInReactor )
             {
-                sb.append( " module: " );
+                sb.append( MODULE_TEXT );
                 sb.append( mavenProject.getId() );
                 sb.append( SystemUtils.LINE_SEPARATOR );
             }
@@ -138,7 +140,7 @@ public class ReactorModuleConvergence
             // CHECKSTYLE_OFF: LineLength
             for ( Entry<MavenProject, List<Dependency>> item : areThereDependenciesWhichAreNotPartOfTheReactor.entrySet() )
             {
-                sb.append( " module: " );
+                sb.append( MODULE_TEXT );
                 sb.append( item.getKey().getId() );
                 sb.append( SystemUtils.LINE_SEPARATOR );
                 for ( Dependency dependency : item.getValue() )
diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireMavenVersion.java b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireMavenVersion.java
index 9766ce7..7c7689b 100644
--- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireMavenVersion.java
+++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireMavenVersion.java
@@ -48,7 +48,7 @@ public class RequireMavenVersion
         }
         catch ( ExpressionEvaluationException e )
         {
-            e.printStackTrace();
+            throw new EnforcerRuleException( "Unable to retrieve the session.", e );
         }
 
     }
diff --git a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/MockPathTranslator.java b/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/MockPathTranslator.java
deleted file mode 100644
index 73a74db..0000000
--- a/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/MockPathTranslator.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.apache.maven.plugins.enforcer;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.
- */
-
-import java.io.File;
-
-import org.apache.maven.model.Model;
-import org.apache.maven.project.path.PathTranslator;
-
-/**
- * The Class MockPathTranslator.
- *
- * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
- */
-public class MockPathTranslator
-    implements PathTranslator
-{
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.maven.project.path.PathTranslator#alignToBaseDirectory(org.apache.maven.model.Model,
-     *      java.io.File)
-     */
-    public void alignToBaseDirectory( Model theModel, File theBasedir )
-    {
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.maven.project.path.PathTranslator#alignToBaseDirectory(java.lang.String, java.io.File)
-     */
-    public String alignToBaseDirectory( String thePath, File theBasedir )
-    {
-        return theBasedir.getAbsolutePath();
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.maven.project.path.PathTranslator#unalignFromBaseDirectory(org.apache.maven.model.Model,
-     *      java.io.File)
-     */
-    public void unalignFromBaseDirectory( Model theModel, File theBasedir )
-    {
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.maven.project.path.PathTranslator#unalignFromBaseDirectory(java.lang.String, java.io.File)
-     */
-    public String unalignFromBaseDirectory( String theDirectory, File theBasedir )
-    {
-        return theBasedir.getAbsolutePath();
-    }
-
-}