Author: khmarbaise
Date: Fri Oct 10 16:35:26 2014
New Revision: 1630934
URL: http://svn.apache.org/r1630934
Log:
- Fixed several Checkstyle errors.
Modified:
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractPropertyEnforcerRule.java
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BanDuplicatePomDependencyVersions.java
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BannedRepositories.java
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/ReactorModuleConvergence.java
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireOS.java
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePrerequisite.java
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireSameVersions.java
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/ArtifactMatcher.java
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/EnforcerRuleUtils.java
Modified:
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
URL:
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java?rev=1630934&r1=1630933&r2=1630934&view=diff
==============================================================================
---
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
(original)
+++
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
Fri Oct 10 16:35:26 2014
@@ -44,7 +44,7 @@ public abstract class AbstractBanDepende
/** Specify if transitive dependencies should be searched (default) or
only look at direct dependencies. */
private boolean searchTransitive = true;
-
+
private transient DependencyGraphBuilder graphBuilder;
/**
@@ -74,17 +74,19 @@ public abstract class AbstractBanDepende
}
catch ( ComponentLookupException e )
{
- // real cause is probably that one of the Maven3 graph builder
could not be initiated and fails with a ClassNotFoundException
+ // real cause is probably that one of the Maven3 graph builder
could not be initiated and fails with a
+ // ClassNotFoundException
try
{
- graphBuilder = (DependencyGraphBuilder) helper.getComponent(
DependencyGraphBuilder.class.getName(), "maven2" );
+ graphBuilder =
+ (DependencyGraphBuilder) helper.getComponent(
DependencyGraphBuilder.class.getName(), "maven2" );
}
catch ( ComponentLookupException e1 )
{
throw new EnforcerRuleException( "Unable to lookup
DependencyGraphBuilder: ", e );
}
}
-
+
// get the correct list of dependencies
Set<Artifact> dependencies = getDependenciesToCheck( project );
@@ -95,7 +97,7 @@ public abstract class AbstractBanDepende
if ( foundExcludes != null && !foundExcludes.isEmpty() )
{
String message = getMessage();
-
+
StringBuilder buf = new StringBuilder();
if ( message != null )
{
@@ -125,12 +127,12 @@ public abstract class AbstractBanDepende
DependencyNode node = graphBuilder.buildDependencyGraph( project,
null );
if ( searchTransitive )
{
- dependencies = getAllDescendants( node );
+ dependencies = getAllDescendants( node );
}
else if ( node.getChildren() != null )
{
dependencies = new HashSet<Artifact>();
- for( DependencyNode depNode : node.getChildren() )
+ for ( DependencyNode depNode : node.getChildren() )
{
dependencies.add( depNode.getArtifact() );
}
@@ -146,7 +148,7 @@ public abstract class AbstractBanDepende
private Set<Artifact> getAllDescendants( DependencyNode node )
{
- Set<Artifact> children = null;
+ Set<Artifact> children = null;
if ( node.getChildren() != null )
{
children = new HashSet<Artifact>();
@@ -172,7 +174,7 @@ public abstract class AbstractBanDepende
* @throws EnforcerRuleException the enforcer rule exception
*/
protected abstract Set<Artifact> checkDependencies( Set<Artifact>
dependencies, Log log )
- throws EnforcerRuleException;
+ throws EnforcerRuleException;
/**
* Checks if is search transitive.
Modified:
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractPropertyEnforcerRule.java
URL:
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractPropertyEnforcerRule.java?rev=1630934&r1=1630933&r2=1630934&view=diff
==============================================================================
---
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractPropertyEnforcerRule.java
(original)
+++
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractPropertyEnforcerRule.java
Fri Oct 10 16:35:26 2014
@@ -40,7 +40,7 @@ public abstract class AbstractPropertyEn
* @see {@link #setRegex(String)}
* @see {@link #getRegex()}
*/
- public String regex = null;
+ private String regex = null;
/**
* Specify a warning message if the regular expression is not matched.
@@ -49,7 +49,7 @@ public abstract class AbstractPropertyEn
* @see {@link #setRegexMessage(String)}
* @see {@link #getRegexMessage()}
*/
- public String regexMessage = null;
+ private String regexMessage = null;
public AbstractPropertyEnforcerRule()
{
Modified:
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java
URL:
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java?rev=1630934&r1=1630933&r2=1630934&view=diff
==============================================================================
---
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java
(original)
+++
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java
Fri Oct 10 16:35:26 2014
@@ -53,7 +53,6 @@ public abstract class AbstractVersionEnf
* @deprecated the visibility will be reduced to private with the next
major version
* @see {@link #setVersion(String)}
* @see {@link #getVersion()}
-
*/
public String version = null;
@@ -97,7 +96,7 @@ public abstract class AbstractVersionEnf
else
{
String message = getMessage();
-
+
if ( StringUtils.isEmpty( message ) )
{
message = msg + " is not in the allowed range " +
vr + ".";
@@ -132,7 +131,7 @@ public abstract class AbstractVersionEnf
{
@SuppressWarnings( "unchecked" )
List<Restriction> restrictions = allowedRange.getRestrictions();
- for ( Restriction restriction : restrictions )
+ for ( Restriction restriction : restrictions )
{
if ( restriction.containsVersion( theVersion ) )
{
@@ -153,7 +152,6 @@ public abstract class AbstractVersionEnf
/*
* (non-Javadoc)
- *
* @see org.apache.maven.enforcer.rule.api.EnforcerRule#getCacheId()
*/
public String getCacheId()
@@ -172,7 +170,6 @@ public abstract class AbstractVersionEnf
/*
* (non-Javadoc)
- *
* @see org.apache.maven.enforcer.rule.api.EnforcerRule#isCacheable()
*/
public boolean isCacheable()
@@ -183,8 +180,8 @@ public abstract class AbstractVersionEnf
/*
* (non-Javadoc)
- *
- * @see
org.apache.maven.enforcer.rule.api.EnforcerRule#isResultValid(org.apache.maven.enforcer.rule.api.EnforcerRule)
+ * @see
+ *
org.apache.maven.enforcer.rule.api.EnforcerRule#isResultValid(org.apache.maven.enforcer.rule.api.EnforcerRule)
*/
public boolean isResultValid( EnforcerRule theCachedRule )
{
Modified:
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BanDuplicatePomDependencyVersions.java
URL:
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BanDuplicatePomDependencyVersions.java?rev=1630934&r1=1630933&r2=1630934&view=diff
==============================================================================
---
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BanDuplicatePomDependencyVersions.java
(original)
+++
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BanDuplicatePomDependencyVersions.java
Fri Oct 10 16:35:26 2014
@@ -40,12 +40,11 @@ import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
/**
- * Since Maven 3
'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique.
- * Early versions of Maven 3 already warn, this rule can force to break a
build for this reason.
+ * Since Maven 3
'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique.
Early versions of Maven
+ * 3 already warn, this rule can force to break a build for this reason.
*
* @author Robert Scholte
* @since 1.3
- *
*/
public class BanDuplicatePomDependencyVersions
extends AbstractNonCacheableEnforcerRule
@@ -64,8 +63,7 @@ public class BanDuplicatePomDependencyVe
{
throw new EnforcerRuleException( "Unable to retrieve the
MavenProject: ", eee );
}
-
-
+
// re-read model, because M3 uses optimized model
MavenXpp3Reader modelReader = new MavenXpp3Reader();
FileReader pomReader = null;
@@ -94,25 +92,24 @@ public class BanDuplicatePomDependencyVe
}
// @todo reuse ModelValidator when possible
-
-// Object modelValidator = null;
-// try
-// {
-// modelValidator = helper.getComponent(
"org.apache.maven.model.validation.ModelValidator" );
-// }
-// catch ( ComponentLookupException e1 )
-// {
-// // noop
-// }
-
-
-// if( modelValidator == null )
-// {
- maven2Validation( helper, model );
-// }
-// else
-// {
-// }
+
+ // Object modelValidator = null;
+ // try
+ // {
+ // modelValidator = helper.getComponent(
"org.apache.maven.model.validation.ModelValidator" );
+ // }
+ // catch ( ComponentLookupException e1 )
+ // {
+ // // noop
+ // }
+
+ // if( modelValidator == null )
+ // {
+ maven2Validation( helper, model );
+ // }
+ // else
+ // {
+ // }
}
private void maven2Validation( EnforcerRuleHelper helper, Model model )
@@ -122,7 +119,7 @@ public class BanDuplicatePomDependencyVe
Map<String, Integer> duplicateDependencies = validateDependencies(
dependencies );
int duplicates = duplicateDependencies.size();
-
+
StringBuilder summary = new StringBuilder();
messageBuilder( duplicateDependencies, "dependencies.dependency",
summary );
@@ -134,7 +131,7 @@ public class BanDuplicatePomDependencyVe
messageBuilder( duplicateManagementDependencies,
"dependencyManagement.dependencies.dependency", summary );
}
-
+
List<Profile> profiles = model.getProfiles();
for ( Profile profile : profiles )
{
@@ -143,24 +140,24 @@ public class BanDuplicatePomDependencyVe
Map<String, Integer> duplicateProfileDependencies =
validateDependencies( profileDependencies );
duplicates += duplicateProfileDependencies.size();
-
+
messageBuilder( duplicateProfileDependencies, "profiles.profile["
+ profile.getId()
+ "].dependencies.dependency", summary );
if ( model.getDependencyManagement() != null )
{
List<Dependency> profileManagementDependencies =
profile.getDependencies();
-
+
Map<String, Integer> duplicateProfileManagementDependencies =
validateDependencies( profileManagementDependencies );
duplicates += duplicateProfileManagementDependencies.size();
-
+
messageBuilder( duplicateProfileManagementDependencies,
"profiles.profile[" + profile.getId()
+ "].dependencyManagement.dependencies.dependency",
summary );
}
}
-
+
if ( summary.length() > 0 )
{
StringBuilder message = new StringBuilder();
@@ -181,7 +178,6 @@ public class BanDuplicatePomDependencyVe
}
}
}
-
private Map<String, Integer> validateDependencies( List<Dependency>
dependencies )
throws EnforcerRuleException
Modified:
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BannedRepositories.java
URL:
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BannedRepositories.java?rev=1630934&r1=1630933&r2=1630934&view=diff
==============================================================================
---
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BannedRepositories.java
(original)
+++
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BannedRepositories.java
Fri Oct 10 16:35:26 2014
@@ -144,9 +144,9 @@ public class BannedRepositories
// ----------------------------------------------------------------------
// Private methods
// ----------------------------------------------------------------------
-
+
/**
- * Check whether specified repositories have banned repositories.
+ * Check whether specified repositories have banned repositories.
*
* @param repositories: candidate repositories.
* @param includes : 'include' patterns.
@@ -161,13 +161,13 @@ public class BannedRepositories
for ( ArtifactRepository repo : repositories )
{
String url = repo.getUrl().trim();
- if ( includes.size()>0 && !match( url, includes ) )
+ if ( includes.size() > 0 && !match( url, includes ) )
{
bannedRepos.add( repo );
continue;
}
- if ( excludes.size()>0 && match( url, excludes ) )
+ if ( excludes.size() > 0 && match( url, excludes ) )
{
bannedRepos.add( repo );
}
@@ -194,7 +194,7 @@ public class BannedRepositories
{
return text.matches( pattern.replace( "?", ".?" ).replace( "*", ".*?"
) );
}
-
+
private String populateErrorMessage( List<ArtifactRepository>
resultBannedRepos, String errorMessagePrefix )
{
StringBuffer errMsg = new StringBuffer( "" );
Modified:
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java
URL:
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java?rev=1630934&r1=1630933&r2=1630934&view=diff
==============================================================================
---
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java
(original)
+++
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java
Fri Oct 10 16:35:26 2014
@@ -52,14 +52,14 @@ public class DependencyConvergence
private static Log log;
private static I18N i18n;
-
- private boolean uniqueVersions;
+
+ private boolean uniqueVersions;
public void setUniqueVersions( boolean uniqueVersions )
{
this.uniqueVersions = uniqueVersions;
}
-
+
/**
* Uses the {@link EnforcerRuleHelper} to populate the values of the
* {@link DependencyTreeBuilder#buildDependencyTree(MavenProject,
ArtifactRepository, ArtifactFactory, ArtifactMetadataSource, ArtifactFilter,
ArtifactCollector)}
Modified:
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/ReactorModuleConvergence.java
URL:
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/ReactorModuleConvergence.java?rev=1630934&r1=1630933&r2=1630934&view=diff
==============================================================================
---
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/ReactorModuleConvergence.java
(original)
+++
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/ReactorModuleConvergence.java
Fri Oct 10 16:35:26 2014
@@ -162,7 +162,7 @@ public class ReactorModuleConvergence
private void checkParentsInReactor( List<MavenProject> sortedProjects )
throws EnforcerRuleException
{
- //After we are sure having consistent version we can simply use the
first one?
+ // After we are sure having consistent version we can simply use the
first one?
String reactorVersion = sortedProjects.get( 0 ).getVersion();
List<MavenProject> areParentsFromTheReactor =
areParentsFromTheReactor( reactorVersion, sortedProjects );
@@ -173,10 +173,10 @@ public class ReactorModuleConvergence
for ( MavenProject mavenProject : areParentsFromTheReactor )
{
sb.append( " --> " );
- sb.append(mavenProject.getId());
- sb.append(" parent:");
- sb.append(mavenProject.getParent().getId());
- sb.append(SystemUtils.LINE_SEPARATOR );
+ sb.append( mavenProject.getId() );
+ sb.append( " parent:" );
+ sb.append( mavenProject.getParent().getId() );
+ sb.append( SystemUtils.LINE_SEPARATOR );
}
throw new EnforcerRuleException( "Reactor modules have parents
which contain a wrong version."
+ sb.toString() );
@@ -229,7 +229,7 @@ public class ReactorModuleConvergence
}
else
{
- //This situation is currently ignored, cause it's handled by
existModulesWithoutParentsInReactor()
+ // This situation is currently ignored, cause it's handled by
existModulesWithoutParentsInReactor()
}
}
@@ -278,8 +278,7 @@ public class ReactorModuleConvergence
}
/**
- * This will check if the given <code>groupId/artifactId</code> is part of
the
- * current reactor.
+ * This will check if the given <code>groupId/artifactId</code> is part of
the current reactor.
*
* @param groupId The groupId
* @param artifactId The artifactId
@@ -318,7 +317,7 @@ public class ReactorModuleConvergence
logger.debug( "Project: " + mavenProject.getId() );
if ( !hasParent( mavenProject ) )
{
- //TODO: Should add an option to force having a parent?
+ // TODO: Should add an option to force having a parent?
if ( mavenProject.isExecutionRoot() )
{
logger.debug( "The root does not need having a parent." );
Modified:
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireOS.java
URL:
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireOS.java?rev=1630934&r1=1630933&r2=1630934&view=diff
==============================================================================
---
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireOS.java
(original)
+++
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireOS.java
Fri Oct 10 16:35:26 2014
@@ -65,7 +65,8 @@ public class RequireOS
*/
public String family = null;
- /** The OS name desired.
+ /**
+ * The OS name desired.
*
* @deprecated the visibility will be reduced to private with the next
major version
* @see {@link #setName(String)}
@@ -73,7 +74,8 @@ public class RequireOS
*/
public String name = null;
- /** The OS version desired.
+ /**
+ * The OS version desired.
*
* @deprecated the visibility will be reduced to private with the next
major version
* @see {@link #setVersion(String)}
@@ -81,20 +83,22 @@ public class RequireOS
*/
public String version = null;
- /** The OS architecture desired.
- *
+ /**
+ * The OS architecture desired.
+ *
* @deprecated the visibility will be reduced to private with the next
major version
* @see {@link #setArch(String)}
- * @see {@link #getArch()}
+ * @see {@link #getArch()}
*/
public String arch = null;
- /** Display detected OS information.
- *
+ /**
+ * Display detected OS information.
+ *
* @deprecated the visibility will be reduced to private with the next
major version
* @see {@link #setDisplay(boolean)}
* @see {@link #isDisplay()}
- * */
+ */
public boolean display = false;
/**
@@ -107,8 +111,8 @@ public class RequireOS
/*
* (non-Javadoc)
- *
- * @see
org.apache.maven.enforcer.rule.api.EnforcerRule#execute(org.apache.maven.enforcer.rule.api.EnforcerRuleHelper)
+ * @see
+ *
org.apache.maven.enforcer.rule.api.EnforcerRule#execute(org.apache.maven.enforcer.rule.api.EnforcerRuleHelper)
*/
public void execute( EnforcerRuleHelper helper )
throws EnforcerRuleException
@@ -118,7 +122,8 @@ public class RequireOS
if ( allParamsEmpty() )
{
- throw new EnforcerRuleException( "All parameters can not be empty.
You must pick at least one of (family, name, version, arch) or use
-Denforcer.os.display=true to see the current OS information." );
+ throw new EnforcerRuleException(
+ "All parameters can not be empty.
You must pick at least one of (family, name, version, arch) or use
-Denforcer.os.display=true to see the current OS information." );
}
if ( isValidFamily( this.family ) )
@@ -347,12 +352,12 @@ public class RequireOS
{
this.version = theVersion;
}
-
+
public final void setDisplay( boolean display )
{
this.display = display;
}
-
+
public final boolean isDisplay()
{
return display;
@@ -360,7 +365,6 @@ public class RequireOS
/*
* (non-Javadoc)
- *
* @see org.apache.maven.enforcer.rule.api.EnforcerRule#getCacheId()
*/
public String getCacheId()
@@ -388,7 +392,6 @@ public class RequireOS
/*
* (non-Javadoc)
- *
* @see org.apache.maven.enforcer.rule.api.EnforcerRule#isCacheable()
*/
public boolean isCacheable()
@@ -399,8 +402,8 @@ public class RequireOS
/*
* (non-Javadoc)
- *
- * @see
org.apache.maven.enforcer.rule.api.EnforcerRule#isResultValid(org.apache.maven.enforcer.rule.api.EnforcerRule)
+ * @see
+ *
org.apache.maven.enforcer.rule.api.EnforcerRule#isResultValid(org.apache.maven.enforcer.rule.api.EnforcerRule)
*/
public boolean isResultValid( EnforcerRule theCachedRule )
{
Modified:
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java
URL:
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java?rev=1630934&r1=1630933&r2=1630934&view=diff
==============================================================================
---
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java
(original)
+++
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java
Fri Oct 10 16:35:26 2014
@@ -84,7 +84,8 @@ public class RequirePluginVersions
extends AbstractNonCacheableEnforcerRule
{
- /** Don't allow the LATEST identifier.
+ /**
+ * Don't allow the LATEST identifier.
*
* @deprecated the visibility will be reduced to private with the next
major version
* @see {@link #setBanLatest(boolean)}
@@ -92,15 +93,17 @@ public class RequirePluginVersions
*/
public boolean banLatest = true;
- /** Don't allow the RELEASE identifier.
- *
+ /**
+ * Don't allow the RELEASE identifier.
+ *
* @deprecated the visibility will be reduced to private with the next
major version
* @see {@link #setBanRelease(boolean)}
* @see {@link #isBanRelease()}
*/
public boolean banRelease = true;
- /** Don't allow snapshot plugins.
+ /**
+ * Don't allow snapshot plugins.
*
* @deprecated the visibility will be reduced to private with the next
major version
* @see {@link #setBanSnapshots(boolean)}
@@ -108,7 +111,8 @@ public class RequirePluginVersions
*/
public boolean banSnapshots = true;
- /** Don't allow timestamp snapshot plugins.
+ /**
+ * Don't allow timestamp snapshot plugins.
*
* @deprecated the visibility will be reduced to private with the next
major version
* @see {@link #setBanTimestamps(boolean)}
@@ -150,8 +154,8 @@ public class RequirePluginVersions
/**
* Same as unCheckedPlugins but as a comma list to better support
properties. Sample form:
* <code>group:artifactId,group2:artifactId2</code>
- * @since 1.0-beta-1
*
+ * @since 1.0-beta-1
* @deprecated the visibility will be reduced to private with the next
major version
* @see {@link #setUnCheckedPlugins(List)}
* @see {@link #getUnCheckedPlugins()}
@@ -190,8 +194,8 @@ public class RequirePluginVersions
/*
* (non-Javadoc)
- *
- * @see
org.apache.maven.enforcer.rule.api.EnforcerRule#execute(org.apache.maven.enforcer.rule.api.EnforcerRuleHelper)
+ * @see
+ *
org.apache.maven.enforcer.rule.api.EnforcerRule#execute(org.apache.maven.enforcer.rule.api.EnforcerRuleHelper)
*/
public void execute( EnforcerRuleHelper helper )
throws EnforcerRuleException
@@ -217,7 +221,8 @@ public class RequirePluginVersions
(Map) ReflectionUtils.getValueIncludingSuperclasses(
"lifecycles", defaultLifeCycles );
lifecycles = lifecyclesMap.values();
}
- else // Using Maven 2
+ else
+ // Using Maven 2
{
lifecycles = (Collection)
ReflectionUtils.getValueIncludingSuperclasses( "lifecycles", life );
}
@@ -238,7 +243,6 @@ public class RequirePluginVersions
allPlugins = addAdditionalPlugins( allPlugins, additionalPlugins );
allPlugins.addAll( getProfilePlugins( project ) );
-
// pull out any we should skip
allPlugins =
(Set) removeUncheckedPlugins( combineUncheckedPlugins(
unCheckedPlugins, unCheckedPluginList ),
@@ -395,16 +399,17 @@ public class RequirePluginVersions
/**
* Combines the old Collection with the new comma separated list.
+ *
* @param uncheckedPlugins
* @param uncheckedPluginsList
* @return
*/
public Collection<String> combineUncheckedPlugins( Collection<String>
uncheckedPlugins, String uncheckedPluginsList )
{
- //if the comma list is empty, then there's nothing to do here.
+ // if the comma list is empty, then there's nothing to do here.
if ( StringUtils.isNotEmpty( uncheckedPluginsList ) )
{
- //make sure there is a collection to add to.
+ // make sure there is a collection to add to.
if ( uncheckedPlugins == null )
{
uncheckedPlugins = new HashSet<String>();
@@ -454,7 +459,7 @@ public class RequirePluginVersions
* Helper method to parse and inject a Plugin.
*
* @param pluginString
- * @param field
+ * @param field
* @throws MojoExecutionException
* @return the plugin
*/
@@ -627,7 +632,8 @@ public class RequirePluginVersions
* @param pluginWrappers the plugins
* @return true, if successful
*/
- protected boolean hasValidVersionSpecified( EnforcerRuleHelper helper,
Plugin source, List<PluginWrapper> pluginWrappers )
+ protected boolean hasValidVersionSpecified( EnforcerRuleHelper helper,
Plugin source,
+ List<PluginWrapper>
pluginWrappers )
{
boolean found = false;
boolean status = false;
@@ -790,7 +796,7 @@ public class RequirePluginVersions
for ( Lifecycle lifecycle : lifecycles )
{
@SuppressWarnings( "unchecked" )
- List<String> phases = lifecycle.getPhases();
+ List<String> phases = lifecycle.getPhases();
for ( String phase : phases )
{
if ( phaseToLifecycleMap.containsKey( phase ) )
@@ -923,7 +929,7 @@ public class RequirePluginVersions
catch ( ComponentLookupException e )
{
log.debug( "Error looking up lifecycle mapping to retrieve
optional mojos. Lifecycle ID: "
- + lifecycle.getId() + ". Error: " + e.getMessage(), e );
+ + lifecycle.getId() + ". Error: " +
e.getMessage(), e );
}
}
@@ -968,7 +974,7 @@ public class RequirePluginVersions
try
{
pluginComponent = pluginManager.getPluginComponent(
plugin, role, roleHint );
-
+
if ( pluginComponent != null )
{
break;
@@ -1056,7 +1062,7 @@ public class RequirePluginVersions
{
List<PluginWrapper> plugins = new ArrayList<PluginWrapper>();
// get all the pom models
-
+
String pomName = null;
try
{
@@ -1076,8 +1082,9 @@ public class RequirePluginVersions
{
try
{
- List<Plugin> modelPlugins = model.getBuild().getPlugins();
- plugins.addAll( PluginWrapper.addAll( utils.resolvePlugins(
modelPlugins ), model.getId() + ".build.plugins" ) );
+ List<Plugin> modelPlugins = model.getBuild().getPlugins();
+ plugins.addAll( PluginWrapper.addAll( utils.resolvePlugins(
modelPlugins ), model.getId()
+ + ".build.plugins" ) );
}
catch ( NullPointerException e )
{
@@ -1086,9 +1093,10 @@ public class RequirePluginVersions
try
{
- List<ReportPlugin> modelReportPlugins =
model.getReporting().getPlugins();
+ List<ReportPlugin> modelReportPlugins =
model.getReporting().getPlugins();
// add the reporting plugins
- plugins.addAll( PluginWrapper.addAll(
utils.resolveReportPlugins( modelReportPlugins ), model.getId() + ".reporting"
) );
+ plugins.addAll( PluginWrapper.addAll(
utils.resolveReportPlugins( modelReportPlugins ), model.getId()
+ + ".reporting" ) );
}
catch ( NullPointerException e )
{
@@ -1097,9 +1105,9 @@ public class RequirePluginVersions
try
{
- List<Plugin> modelPlugins =
model.getBuild().getPluginManagement().getPlugins();
- plugins.addAll( PluginWrapper.addAll( utils.resolvePlugins(
modelPlugins ),
- model.getId() +
".build.pluginManagement.plugins" ) );
+ List<Plugin> modelPlugins =
model.getBuild().getPluginManagement().getPlugins();
+ plugins.addAll( PluginWrapper.addAll( utils.resolvePlugins(
modelPlugins ), model.getId()
+ + ".build.pluginManagement.plugins" ) );
}
catch ( NullPointerException e )
{
@@ -1112,7 +1120,7 @@ public class RequirePluginVersions
{
try
{
- List<Plugin> modelPlugins =
profile.getBuild().getPlugins();
+ List<Plugin> modelPlugins =
profile.getBuild().getPlugins();
plugins.addAll( PluginWrapper.addAll(
utils.resolvePlugins( modelPlugins ), model.getId()
+ ".profiles.profile[" + profile.getId() +
"].build.plugins" ) );
}
@@ -1123,10 +1131,11 @@ public class RequirePluginVersions
try
{
- List<ReportPlugin> modelReportPlugins =
profile.getReporting().getPlugins();
+ List<ReportPlugin> modelReportPlugins =
profile.getReporting().getPlugins();
// add the reporting plugins
- plugins.addAll( PluginWrapper.addAll(
utils.resolveReportPlugins( modelReportPlugins ), model.getId()
- + "profile[" + profile.getId() + "].reporting.plugins"
) );
+ plugins.addAll( PluginWrapper.addAll(
utils.resolveReportPlugins( modelReportPlugins ),
+ model.getId() +
"profile[" + profile.getId()
+ +
"].reporting.plugins" ) );
}
catch ( NullPointerException e )
{
@@ -1134,10 +1143,9 @@ public class RequirePluginVersions
}
try
{
- List<Plugin> modelPlugins =
profile.getBuild().getPluginManagement().getPlugins();
- plugins.addAll( PluginWrapper.addAll(
utils.resolvePlugins( modelPlugins ),
- model.getId() +
"profile[" + profile.getId()
- +
"].build.pluginManagement.plugins" ) );
+ List<Plugin> modelPlugins =
profile.getBuild().getPluginManagement().getPlugins();
+ plugins.addAll( PluginWrapper.addAll(
utils.resolvePlugins( modelPlugins ), model.getId()
+ + "profile[" + profile.getId() +
"].build.pluginManagement.plugins" ) );
}
catch ( NullPointerException e )
{
@@ -1258,22 +1266,22 @@ public class RequirePluginVersions
{
this.unCheckedPlugins = unCheckedPlugins;
}
-
+
public final void setPhases( String phases )
{
this.phases = phases;
}
-
+
public final String getPhases()
{
return phases;
}
-
+
public final void setAdditionalPlugins( List<String> additionalPlugins )
{
this.additionalPlugins = additionalPlugins;
}
-
+
public final List<String> getAdditionalPlugins()
{
return additionalPlugins;
Modified:
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePrerequisite.java
URL:
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePrerequisite.java?rev=1630934&r1=1630933&r2=1630934&view=diff
==============================================================================
---
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePrerequisite.java
(original)
+++
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequirePrerequisite.java
Fri Oct 10 16:35:26 2014
@@ -30,28 +30,26 @@ import org.apache.maven.project.MavenPro
import
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
/**
- *
* @author Robert Scholte
* @since 1.3
*/
-public class RequirePrerequisite extends AbstractNonCacheableEnforcerRule
+public class RequirePrerequisite
+ extends AbstractNonCacheableEnforcerRule
{
/**
* Only the projects with one of these packagings will be enforced to have
the correct prerequisite.
- *
+ *
* @since 1.4
*/
private List<String> packagings;
-
+
/**
* Can either be version or a range, e.g. {@code 2.2.1} or {@code [2.2.1,)}
*/
private String mavenVersion;
/**
- * Set the mavenVersion
- *
- * Can either be version or a range, e.g. {@code 2.2.1} or {@code [2.2.1,)}
+ * Set the mavenVersion Can either be version or a range, e.g. {@code
2.2.1} or {@code [2.2.1,)}
*
* @param mavenVersion the version or {@code null}
*/
@@ -59,7 +57,7 @@ public class RequirePrerequisite extends
{
this.mavenVersion = mavenVersion;
}
-
+
/**
* Only the projects with one of these packagings will be enforced to have
the correct prerequisite.
*
@@ -70,7 +68,7 @@ public class RequirePrerequisite extends
{
this.packagings = packagings;
}
-
+
/**
* {@inheritDoc}
*/
@@ -92,9 +90,9 @@ public class RequirePrerequisite extends
helper.getLog().debug( "Packaging is " +
project.getPackaging() + ", skipping requirePrerequisite rule" );
return;
}
-
- Prerequisites prerequisites = project.getPrerequisites();
-
+
+ Prerequisites prerequisites = project.getPrerequisites();
+
if ( prerequisites == null )
{
throw new EnforcerRuleException( "Requires prerequisite not
set" );
@@ -102,18 +100,18 @@ public class RequirePrerequisite extends
if ( mavenVersion != null )
{
-
+
VersionRange requiredVersionRange =
VersionRange.createFromVersionSpec( mavenVersion );
if ( !requiredVersionRange.hasRestrictions() )
{
requiredVersionRange = VersionRange.createFromVersionSpec(
"[" + mavenVersion + ",)" );
}
-
+
VersionRange specifiedVersion =
VersionRange.createFromVersionSpec( prerequisites.getMaven() );
-
+
VersionRange restrictedVersionRange =
requiredVersionRange.restrict( specifiedVersion );
-
+
if ( restrictedVersionRange.getRecommendedVersion() == null )
{
throw new EnforcerRuleException( "The specified Maven
prerequisite( " + specifiedVersion
Modified:
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireSameVersions.java
URL:
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireSameVersions.java?rev=1630934&r1=1630933&r2=1630934&view=diff
==============================================================================
---
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireSameVersions.java
(original)
+++
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireSameVersions.java
Fri Oct 10 16:35:26 2014
@@ -35,7 +35,6 @@ import org.apache.maven.project.MavenPro
import
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
/**
- *
* @author Robert Scholte
* @since 1.3
*/
@@ -97,19 +96,19 @@ public class RequireSameVersions
String source )
{
Map<String, List<String>> versionMembers = new LinkedHashMap<String,
List<String>>();
-
+
List<Pattern> regExs = new ArrayList<Pattern>();
for ( String pattern : patterns )
{
String regex = pattern.replace( ".", "\\." ).replace( "*", ".*"
).replace( ":", "\\:" ).replace( '?', '.' );
// pattern is groupId[:artifactId[:type[:classifier]]]
- regExs.add( Pattern.compile( regex + "(\\:.+)?" ) );
+ regExs.add( Pattern.compile( regex + "(\\:.+)?" ) );
}
-
+
for ( Artifact artifact : artifacts )
{
- for ( Pattern regEx: regExs )
+ for ( Pattern regEx : regExs )
{
if ( regEx.matcher( artifact.getDependencyConflictId()
).matches() )
{
Modified:
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/ArtifactMatcher.java
URL:
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/ArtifactMatcher.java?rev=1630934&r1=1630933&r2=1630934&view=diff
==============================================================================
---
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/ArtifactMatcher.java
(original)
+++
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/ArtifactMatcher.java
Fri Oct 10 16:35:26 2014
@@ -134,13 +134,13 @@ public final class ArtifactMatcher
String regex =
expression.replace( ".", "\\." ).replace( "*", ".*" ).replace(
":", "\\:" ).replace( '?', '.' );
- //TODO: Check if this can be done better or prevented earlier.
+ // TODO: Check if this can be done better or prevented earlier.
if ( input == null )
{
input = "";
}
- return java.util.regex.Pattern.matches( regex , input );
+ return java.util.regex.Pattern.matches( regex, input );
}
@Override
Modified:
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/EnforcerRuleUtils.java
URL:
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/EnforcerRuleUtils.java?rev=1630934&r1=1630933&r2=1630934&view=diff
==============================================================================
---
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/EnforcerRuleUtils.java
(original)
+++
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/EnforcerRuleUtils.java
Fri Oct 10 16:35:26 2014
@@ -132,13 +132,11 @@ public class EnforcerRuleUtils
* Gets the pom model for this file.
*
* @param pom the pom
- *
* @return the model
- *
* @throws IOException Signals that an I/O exception has occurred.
* @throws XmlPullParserException the xml pull parser exception
*/
- private Model readModel ( File pom )
+ private Model readModel( File pom )
throws IOException, XmlPullParserException
{
Reader reader = ReaderFactory.newXmlReader( pom );
@@ -157,23 +155,20 @@ public class EnforcerRuleUtils
}
/**
- * This method gets the model for the defined artifact.
- * Looks first in the filesystem, then tries to get it
- * from the repo.
+ * This method gets the model for the defined artifact. Looks first in the
filesystem, then tries to get it from the
+ * repo.
*
* @param groupId the group id
* @param artifactId the artifact id
* @param version the version
* @param pom the pom
- *
* @return the pom model
- *
* @throws ArtifactResolutionException the artifact resolution exception
* @throws ArtifactNotFoundException the artifact not found exception
* @throws XmlPullParserException the xml pull parser exception
* @throws IOException Signals that an I/O exception has occurred.
*/
- private Model getPomModel ( String groupId, String artifactId, String
version, File pom )
+ private Model getPomModel( String groupId, String artifactId, String
version, File pom )
throws ArtifactResolutionException, ArtifactNotFoundException,
IOException, XmlPullParserException
{
Model model = null;
@@ -219,22 +214,19 @@ public class EnforcerRuleUtils
}
/**
- * This method loops through all the parents, getting
- * each pom model and then its parent.
+ * This method loops through all the parents, getting each pom model and
then its parent.
*
* @param groupId the group id
* @param artifactId the artifact id
* @param version the version
* @param pom the pom
- *
* @return the models recursively
- *
* @throws ArtifactResolutionException the artifact resolution exception
* @throws ArtifactNotFoundException the artifact not found exception
* @throws IOException Signals that an I/O exception has occurred.
* @throws XmlPullParserException the xml pull parser exception
*/
- public List<Model> getModelsRecursively ( String groupId, String
artifactId, String version, File pom )
+ public List<Model> getModelsRecursively( String groupId, String
artifactId, String version, File pom )
throws ArtifactResolutionException, ArtifactNotFoundException,
IOException, XmlPullParserException
{
List<Model> models = null;
@@ -279,10 +271,9 @@ public class EnforcerRuleUtils
* @param artifactId the artifact id
* @param version the version
* @param model Model being checked.
- *
* @return true, if check if model matches
*/
- protected boolean checkIfModelMatches ( String groupId, String artifactId,
String version, Model model )
+ protected boolean checkIfModelMatches( String groupId, String artifactId,
String version, Model model )
{
// try these first.
String modelGroup = model.getGroupId();
@@ -310,7 +301,7 @@ public class EnforcerRuleUtils
// MENFORCER-30, handle cases where the value is a property
like ${project.parent.version}
modelVersion = (String) helper.evaluate( modelVersion );
}
-
+
// Is this only required for Maven2?
modelArtifactId = (String) helper.evaluate( modelArtifactId );
}
@@ -326,11 +317,10 @@ public class EnforcerRuleUtils
{
// as above
}
- return ( StringUtils.equals( groupId, modelGroup ) &&
StringUtils.equals( version, modelVersion ) && StringUtils
- .equals( artifactId, modelArtifactId ) );
+ return ( StringUtils.equals( groupId, modelGroup ) &&
StringUtils.equals( version, modelVersion ) && StringUtils.equals( artifactId,
+
modelArtifactId ) );
}
-
-
+
private void resolve( Plugin plugin )
{
try
@@ -344,7 +334,7 @@ public class EnforcerRuleUtils
// this should have gone already before
}
}
-
+
private void resolve( ReportPlugin plugin )
{
try
@@ -358,7 +348,7 @@ public class EnforcerRuleUtils
// this should have gone already before
}
}
-
+
public List<Plugin> resolvePlugins( List<Plugin> plugins )
{
for ( Plugin plugin : plugins )
@@ -367,7 +357,7 @@ public class EnforcerRuleUtils
}
return plugins;
}
-
+
public List<ReportPlugin> resolveReportPlugins( List<ReportPlugin>
reportPlugins )
{
for ( ReportPlugin plugin : reportPlugins )
@@ -377,5 +367,4 @@ public class EnforcerRuleUtils
return reportPlugins;
}
-
}