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/17 18:00:07 UTC
[maven-enforcer] 01/01: Code improvements o Removed unused class. o
Some minore improvements.
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 a408f10362b562f5f4859881d5009f446b810ae1
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();
- }
-
-}
--
To stop receiving notification emails like this one, please contact
khmarbaise@apache.org.