mirror of https://github.com/apache/maven.git
apply some inspections
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@219826 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ee31f9650f
commit
685bfbcb12
|
@ -42,12 +42,12 @@ import java.util.Properties;
|
|||
/**
|
||||
* Prepare for a release in SCM
|
||||
*
|
||||
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
|
||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||
* @version $Id: DoxiaMojo.java 169372 2005-05-09 22:47:34Z evenisse $
|
||||
* @goal prepare
|
||||
* @requiresDependencyResolution test
|
||||
*
|
||||
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
|
||||
* @author <a href="mailto:jason@maven.org>Jason van Zyl</a>
|
||||
* @version $Id: DoxiaMojo.java 169372 2005-05-09 22:47:34Z evenisse $
|
||||
* @todo check how this works with version ranges
|
||||
*/
|
||||
public class PrepareReleaseMojo
|
||||
extends AbstractReleaseMojo
|
||||
|
@ -127,8 +127,7 @@ public class PrepareReleaseMojo
|
|||
for ( Iterator i = changedFiles.iterator(); i.hasNext(); )
|
||||
{
|
||||
ScmFile f = (ScmFile) i.next();
|
||||
if ( f.getPath().equals( "pom.xml.backup" ) ||
|
||||
f.getPath().equals( RELEASE_PROPS ) )
|
||||
if ( f.getPath().equals( "pom.xml.backup" ) || f.getPath().equals( RELEASE_PROPS ) )
|
||||
{
|
||||
i.remove();
|
||||
}
|
||||
|
@ -147,7 +146,8 @@ public class PrepareReleaseMojo
|
|||
message.append( "\n" );
|
||||
}
|
||||
|
||||
throw new MojoExecutionException( "Cannot prepare the release because you have local modifications : \n" + message.toString() );
|
||||
throw new MojoExecutionException(
|
||||
"Cannot prepare the release because you have local modifications : \n" + message.toString() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,8 +230,8 @@ public class PrepareReleaseMojo
|
|||
message.append( "\n" );
|
||||
}
|
||||
|
||||
throw new MojoExecutionException( "Can't release project due to non released dependencies :\n"
|
||||
+ message.toString() );
|
||||
throw new MojoExecutionException(
|
||||
"Can't release project due to non released dependencies :\n" + message.toString() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -278,8 +278,8 @@ public class PrepareReleaseMojo
|
|||
|
||||
model.getScm().setConnection( rewriteScmConnection( model.getScm().getConnection(), getTagLabel() ) );
|
||||
|
||||
model.getScm().setDeveloperConnection( rewriteScmConnection( model.getScm().getDeveloperConnection(),
|
||||
getTagLabel() ) );
|
||||
model.getScm().setDeveloperConnection(
|
||||
rewriteScmConnection( model.getScm().getDeveloperConnection(), getTagLabel() ) );
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -323,10 +323,10 @@ public class PrepareReleaseMojo
|
|||
for ( Iterator j = model.getDependencies().iterator(); j.hasNext(); )
|
||||
{
|
||||
Dependency dependency = (Dependency) j.next();
|
||||
if ( artifact.getGroupId().equals( dependency.getGroupId() )
|
||||
&& artifact.getArtifactId().equals( dependency.getArtifactId() )
|
||||
&& artifact.getBaseVersion().equals( dependency.getVersion() )
|
||||
&& artifact.getType().equals( dependency.getType() ) )
|
||||
if ( artifact.getGroupId().equals( dependency.getGroupId() ) &&
|
||||
artifact.getArtifactId().equals( dependency.getArtifactId() ) &&
|
||||
artifact.getBaseVersion().equals( dependency.getVersion() ) &&
|
||||
artifact.getType().equals( dependency.getType() ) )
|
||||
{
|
||||
dependency.setVersion( artifact.getVersion() );
|
||||
}
|
||||
|
@ -343,8 +343,8 @@ public class PrepareReleaseMojo
|
|||
for ( Iterator j = model.getBuild().getPlugins().iterator(); j.hasNext(); )
|
||||
{
|
||||
Plugin plugin = (Plugin) j.next();
|
||||
if ( artifact.getGroupId().equals( plugin.getGroupId() )
|
||||
&& artifact.getArtifactId().equals( plugin.getArtifactId() ) )
|
||||
if ( artifact.getGroupId().equals( plugin.getGroupId() ) &&
|
||||
artifact.getArtifactId().equals( plugin.getArtifactId() ) )
|
||||
{
|
||||
plugin.setGroupId( artifact.getGroupId() );
|
||||
plugin.setVersion( artifact.getVersion() );
|
||||
|
@ -361,7 +361,7 @@ public class PrepareReleaseMojo
|
|||
|
||||
transformer.setProject( project.getFile() );
|
||||
|
||||
transformer.setUpdatedModel ( model );
|
||||
transformer.setUpdatedModel( model );
|
||||
|
||||
transformer.transformNodes();
|
||||
|
||||
|
@ -389,7 +389,8 @@ public class PrepareReleaseMojo
|
|||
{
|
||||
nextVersionString = Integer.toString( Integer.parseInt( nextVersionString ) + 1 );
|
||||
|
||||
projectVersion = projectVersion.substring( 0, projectVersion.lastIndexOf( "-" ) + 1 ) + nextVersionString + SNAPSHOT;
|
||||
projectVersion = projectVersion.substring( 0, projectVersion.lastIndexOf( "-" ) + 1 ) + nextVersionString +
|
||||
SNAPSHOT;
|
||||
}
|
||||
catch ( NumberFormatException e )
|
||||
{
|
||||
|
@ -426,7 +427,7 @@ public class PrepareReleaseMojo
|
|||
|
||||
transformer.setProject( project.getFile() );
|
||||
|
||||
transformer.setUpdatedModel ( model );
|
||||
transformer.setUpdatedModel( model );
|
||||
|
||||
transformer.transformNodes();
|
||||
|
||||
|
@ -570,11 +571,11 @@ public class PrepareReleaseMojo
|
|||
{
|
||||
if ( scmConnection.startsWith( "svn" ) )
|
||||
{
|
||||
if ( scmConnection.endsWith( "trunk/") )
|
||||
if ( scmConnection.endsWith( "trunk/" ) )
|
||||
{
|
||||
scmConnection = scmConnection.substring( 0, scmConnection.length() - "trunk/".length() );
|
||||
}
|
||||
if ( scmConnection.endsWith( "branches/") )
|
||||
if ( scmConnection.endsWith( "branches/" ) )
|
||||
{
|
||||
scmConnection = scmConnection.substring( 0, scmConnection.length() - "branches/".length() );
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class MavenMetadataSource
|
|||
artifact.getVersion(), artifact.getScope() );
|
||||
|
||||
// TODO: this a very thin wrapper around a project builder - is it needed?
|
||||
List dependencies = null;
|
||||
List dependencies;
|
||||
|
||||
// Use the ProjectBuilder, to enable post-processing and inheritance calculation before retrieving the
|
||||
// associated artifacts.
|
||||
|
@ -101,10 +101,9 @@ public class MavenMetadataSource
|
|||
{
|
||||
Dependency d = (Dependency) i.next();
|
||||
|
||||
VersionRange versionRange = VersionRange.createFromVersionSpec( d.getVersion() );
|
||||
Artifact artifact = artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(),
|
||||
VersionRange.createFromVersionSpec(
|
||||
d.getVersion() ), d.getType(),
|
||||
d.getScope(),
|
||||
versionRange, d.getType(), d.getScope(),
|
||||
inheritedScope );
|
||||
|
||||
if ( artifact != null && ( dependencyFilter == null || dependencyFilter.include( artifact ) ) )
|
||||
|
|
|
@ -19,8 +19,8 @@ package org.apache.maven.report.projectinfo;
|
|||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
||||
import org.apache.maven.reporting.AbstractMavenReport;
|
||||
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
||||
import org.apache.maven.reporting.MavenReportException;
|
||||
import org.codehaus.doxia.sink.Sink;
|
||||
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
||||
|
@ -36,11 +36,10 @@ import java.util.Set;
|
|||
/**
|
||||
* Generates the dependencies report.
|
||||
*
|
||||
* @goal dependencies
|
||||
*
|
||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
* @goal dependencies
|
||||
* @plexus.component
|
||||
*/
|
||||
public class DependenciesReport
|
||||
|
@ -107,7 +106,7 @@ public class DependenciesReport
|
|||
}
|
||||
|
||||
/**
|
||||
* @see org.apache.maven.reporting.AbstractMavenReport#getSiteRenderer()
|
||||
* @see AbstractMavenReport#getSiteRenderer()
|
||||
*/
|
||||
protected SiteRenderer getSiteRenderer()
|
||||
{
|
||||
|
@ -126,7 +125,7 @@ public class DependenciesReport
|
|||
|
||||
r.render();
|
||||
}
|
||||
catch( IOException e )
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new MavenReportException( "Can't write the report " + getOutputName(), e );
|
||||
}
|
||||
|
@ -216,7 +215,8 @@ public class DependenciesReport
|
|||
tableCaption( getBundle( locale ).getString( "report.transitivedependencies.intro" ) );
|
||||
|
||||
String groupId = getBundle( locale ).getString( "report.transitivedependencies.column.groupId" );
|
||||
String artifactId = getBundle( locale ).getString( "report.transitivedependencies.column.artifactId" );
|
||||
String artifactId = getBundle( locale ).getString(
|
||||
"report.transitivedependencies.column.artifactId" );
|
||||
String version = getBundle( locale ).getString( "report.transitivedependencies.column.version" );
|
||||
|
||||
tableHeader( new String[]{groupId, artifactId, version} );
|
||||
|
@ -225,7 +225,8 @@ public class DependenciesReport
|
|||
{
|
||||
Artifact artifact = (Artifact) i.next();
|
||||
|
||||
tableRow( new String[]{artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion()} );
|
||||
tableRow(
|
||||
new String[]{artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion()} );
|
||||
}
|
||||
|
||||
endTable();
|
||||
|
@ -241,13 +242,13 @@ public class DependenciesReport
|
|||
*
|
||||
* @param project a Maven project
|
||||
* @return a set of transitive dependencies
|
||||
* @todo check if this works with version ranges
|
||||
*/
|
||||
private Set getTransitiveDependencies( MavenProject project )
|
||||
{
|
||||
Set result = new HashSet();
|
||||
|
||||
if ( ( project.getDependencies() == null ) ||
|
||||
( project.getArtifacts() == null ) )
|
||||
if ( project.getDependencies() == null || project.getArtifacts() == null )
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
@ -257,15 +258,15 @@ public class DependenciesReport
|
|||
|
||||
for ( Iterator j = artifacts.iterator(); j.hasNext(); )
|
||||
{
|
||||
Artifact artifact = (Artifact)j.next();
|
||||
Artifact artifact = (Artifact) j.next();
|
||||
|
||||
boolean toadd = true;
|
||||
for ( Iterator i = dependencies.iterator(); i.hasNext(); )
|
||||
{
|
||||
Dependency dependency = (Dependency) i.next();
|
||||
if ( ( artifact.getArtifactId().equals( dependency.getArtifactId() ) ) &&
|
||||
( artifact.getGroupId().equals( dependency.getGroupId() ) ) &&
|
||||
( artifact.getVersion().equals( dependency.getVersion() ) ) )
|
||||
if ( artifact.getArtifactId().equals( dependency.getArtifactId() ) &&
|
||||
artifact.getGroupId().equals( dependency.getGroupId() ) &&
|
||||
artifact.getVersion().equals( dependency.getVersion() ) )
|
||||
{
|
||||
toadd = false;
|
||||
break;
|
||||
|
@ -284,6 +285,6 @@ public class DependenciesReport
|
|||
|
||||
private static ResourceBundle getBundle( Locale locale )
|
||||
{
|
||||
return ResourceBundle.getBundle("project-info-report", locale, DependenciesReport.class.getClassLoader() );
|
||||
return ResourceBundle.getBundle( "project-info-report", locale, DependenciesReport.class.getClassLoader() );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue