PR: MNG-829

Submitted by: Johnny R. Ruiz III
Reviewed by:  Brett Porter
use File for basedir aligned parameters in various plugins

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@312877 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-10-11 13:35:24 +00:00
parent 55bbfd0fd6
commit 9ad08679f8
8 changed files with 60 additions and 62 deletions

View File

@ -93,10 +93,6 @@ else if ( repository.isBlacklisted() )
{
file.setLastModified( System.currentTimeMillis() );
}
else
{
metadata.storeInLocalRepository( localRepository, repository );
}
}
}
cachedMetadata.add( metadata.getKey() );

View File

@ -30,7 +30,7 @@ public class AntlrPlugin
* @parameter expression="${basedir}/src/main/antlr"
* @required
*/
private String sourceDirectory;
private File sourceDirectory;
/**
* @parameter expression="${project.build.directory}/generated-sources/antlr"

View File

@ -45,21 +45,21 @@ public class EarMojo
* @parameter expression="${basedir}/src/main/application"
* @required
*/
private String earSourceDirectory;
private File earSourceDirectory;
/**
* The location of the manifest file to be used within the ear file.
*
* @parameter expression="${basedir}/src/main/application/META-INF/MANIFEST.MF"
*/
private String manifestFile;
private File manifestFile;
/**
* The location of the application.xml file to be used within the ear file.
*
* @parameter expression="${basedir}/src/main/application/META-INF/application.xml"
*/
private String applicationXmlFile;
private File applicationXmlFile;
/**
* The directory for the generated EAR.
@ -144,7 +144,7 @@ public void execute()
// Copy source files
try
{
File earSourceDir = new File( earSourceDirectory );
File earSourceDir = earSourceDirectory;
if ( earSourceDir.exists() )
{
getLog().info( "Copy ear sources to " + getWorkDirectory().getAbsolutePath() );
@ -206,7 +206,8 @@ private static File buildDestinationFile( File buildDir, String uri )
private void includeCustomManifestFile()
{
File customManifestFile = new File( manifestFile );
File customManifestFile = manifestFile;
if ( !customManifestFile.exists() )
{
getLog().info( "Could not find manifest file: " + manifestFile + " - Generating one" );

View File

@ -52,14 +52,14 @@ public class RarMojo
* @parameter expression="${basedir}/src/main/rar"
* @required
*/
private String rarSourceDirectory;
private File rarSourceDirectory;
/**
* The location of the ra.xml file to be used within the rar file.
*
* @parameter expression="${basedir}/src/main/rar/META-INF/ra.xml"
*/
private String raXmlFile;
private File raXmlFile;
/**
* Specify if the generated jar file of this project should be
@ -74,7 +74,7 @@ public class RarMojo
*
* @parameter expression="${basedir}/src/main/rar/META-INF/MANIFEST.MF"
*/
private String manifestFile;
private File manifestFile;
/**
* Directory that resources are copied to during the build.
@ -181,7 +181,7 @@ public void execute()
// Copy source files
try
{
File rarSourceDir = new File( rarSourceDirectory );
File rarSourceDir = rarSourceDirectory;
if ( rarSourceDir.exists() )
{
getLog().info( "Copy rar resources to " + getBuildDir().getAbsolutePath() );
@ -241,7 +241,7 @@ protected File getBuildDir()
private void includeCustomManifestFile()
{
File customManifestFile = new File( manifestFile );
File customManifestFile = manifestFile;
if ( !customManifestFile.exists() )
{
getLog().info( "Could not find manifest file: " + manifestFile +" - Generating one");
@ -256,10 +256,10 @@ private void includeCustomManifestFile()
private void includeCustomRaXmlFile()
throws IOException
{
if (raXmlFile == null || raXmlFile.trim().length() == 0) {
if (raXmlFile == null) {
}
File raXml = new File(raXmlFile );
File raXml = raXmlFile;
if (raXml.exists()) {
getLog().info( "Using ra.xml "+ raXmlFile);
File metaInfDir = new File(getBuildDir(), "META-INF");

View File

@ -16,6 +16,11 @@
* limitations under the License.
*/
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import org.apache.maven.model.Profile;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.release.helpers.ReleaseProgressTracker;
@ -27,10 +32,6 @@
import org.codehaus.plexus.util.cli.DefaultConsumer;
import org.codehaus.plexus.util.cli.StreamConsumer;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
/**
* Perform a release from SCM
*
@ -47,7 +48,7 @@ public class PerformReleaseMojo
* @required
* @readonly
*/
private String basedir;
private File basedir;
/**
* @parameter expression="${goals}"
@ -159,7 +160,7 @@ protected ReleaseProgressTracker getReleaseProgress()
{
try
{
releaseProgress = ReleaseProgressTracker.load( basedir );
releaseProgress = ReleaseProgressTracker.load( basedir.getAbsolutePath() );
}
catch ( IOException e )
{

View File

@ -16,6 +16,19 @@
* limitations under the License.
*/
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
@ -49,19 +62,6 @@
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
/**
* Prepare for a release in SCM
*
@ -86,7 +86,7 @@ public class PrepareReleaseMojo
* @required
* @readonly
*/
private String basedir;
private File basedir;
/**
* @parameter expression="${settings.interactiveMode}"
@ -183,7 +183,7 @@ protected void executeTask()
{
try
{
getReleaseProgress().checkpoint( basedir, ReleaseProgressTracker.CP_INITIALIZED );
getReleaseProgress().checkpoint( basedir.getAbsolutePath(), ReleaseProgressTracker.CP_INITIALIZED );
}
catch ( IOException e )
{
@ -220,7 +220,7 @@ protected void executeTask()
try
{
getReleaseProgress().checkpoint( basedir, ReleaseProgressTracker.CP_POM_TRANSFORMED_FOR_RELEASE );
getReleaseProgress().checkpoint( basedir.getAbsolutePath(), ReleaseProgressTracker.CP_POM_TRANSFORMED_FOR_RELEASE );
}
catch ( IOException e )
{
@ -253,7 +253,7 @@ protected void executeTask()
try
{
getReleaseProgress().checkpoint( basedir,
getReleaseProgress().checkpoint( basedir.getAbsolutePath(),
ReleaseProgressTracker.CP_POM_TRANSORMED_FOR_DEVELOPMENT );
}
catch ( IOException e )
@ -268,7 +268,7 @@ protected void executeTask()
try
{
getReleaseProgress().checkpoint( basedir, ReleaseProgressTracker.CP_PREPARED_RELEASE );
getReleaseProgress().checkpoint( basedir.getAbsolutePath(), ReleaseProgressTracker.CP_PREPARED_RELEASE );
}
catch ( IOException e )
{
@ -405,11 +405,11 @@ protected ReleaseProgressTracker getReleaseProgress()
{
try
{
releaseProgress = ReleaseProgressTracker.loadOrCreate( basedir );
releaseProgress = ReleaseProgressTracker.loadOrCreate( basedir.getAbsolutePath() );
}
catch ( IOException e )
{
getLog().warn( "Cannot read existing release progress file from directory: " + basedir + "." );
getLog().warn( "Cannot read existing release progress file from directory: " + basedir.getAbsolutePath() + "." );
getLog().debug( "Cause", e );
releaseProgress = ReleaseProgressTracker.create();
@ -490,7 +490,7 @@ private void checkForLocalModifications()
try
{
ScmHelper scm = getScm( basedir );
ScmHelper scm = getScm( basedir.getAbsolutePath() );
changedFiles = scm.getStatus();
}
@ -529,7 +529,7 @@ private void checkForLocalModifications()
try
{
getReleaseProgress().checkpoint( basedir, ReleaseProgressTracker.CP_LOCAL_MODIFICATIONS_CHECKED );
getReleaseProgress().checkpoint( basedir.getAbsolutePath(), ReleaseProgressTracker.CP_LOCAL_MODIFICATIONS_CHECKED );
}
catch ( IOException e )
{
@ -824,11 +824,11 @@ private void generateReleasePoms()
try
{
canonicalBasedir = trimPathForScmCalculation( new File( basedir ) );
canonicalBasedir = trimPathForScmCalculation( basedir );
}
catch ( IOException e )
{
throw new MojoExecutionException( "Cannot canonicalize basedir: " + basedir, e );
throw new MojoExecutionException( "Cannot canonicalize basedir: " + basedir.getAbsolutePath(), e );
}
for ( Iterator it = reactorProjects.iterator(); it.hasNext(); )
@ -1037,7 +1037,7 @@ else if ( finalName.indexOf( "SNAPSHOT" ) > -1 )
releasePomPath = releasePomPath.substring( canonicalBasedir.length() + 1 );
ScmHelper scm = getScm( basedir );
ScmHelper scm = getScm( basedir.getAbsolutePath() );
scm.add( releasePomPath );
}
@ -1052,7 +1052,7 @@ else if ( finalName.indexOf( "SNAPSHOT" ) > -1 )
try
{
getReleaseProgress().checkpoint( basedir, ReleaseProgressTracker.CP_GENERATED_RELEASE_POM );
getReleaseProgress().checkpoint( basedir.getAbsolutePath(), ReleaseProgressTracker.CP_GENERATED_RELEASE_POM );
}
catch ( IOException e )
{
@ -1182,7 +1182,7 @@ private void checkInRelease()
try
{
getReleaseProgress().checkpoint( basedir, ReleaseProgressTracker.CP_CHECKED_IN_RELEASE_VERSION );
getReleaseProgress().checkpoint( basedir.getAbsolutePath(), ReleaseProgressTracker.CP_CHECKED_IN_RELEASE_VERSION );
}
catch ( IOException e )
{
@ -1202,7 +1202,7 @@ private void removeReleasePoms()
try
{
String canonicalBasedir = trimPathForScmCalculation( new File( basedir ) );
String canonicalBasedir = trimPathForScmCalculation( basedir );
for ( Iterator it = reactorProjects.iterator(); it.hasNext(); )
{
@ -1214,7 +1214,7 @@ private void removeReleasePoms()
releasePomPath = releasePomPath.substring( canonicalBasedir.length() + 1 );
ScmHelper scm = getScm( basedir );
ScmHelper scm = getScm( basedir.getAbsolutePath() );
scm.remove( "Removing for next development iteration.", releasePomPath );
@ -1234,7 +1234,7 @@ private void removeReleasePoms()
try
{
getReleaseProgress().checkpoint( basedir, ReleaseProgressTracker.CP_REMOVED_RELEASE_POM );
getReleaseProgress().checkpoint( basedir.getAbsolutePath(), ReleaseProgressTracker.CP_REMOVED_RELEASE_POM );
}
catch ( IOException e )
{
@ -1269,7 +1269,7 @@ private void checkInNextSnapshot()
try
{
getReleaseProgress().checkpoint( basedir, ReleaseProgressTracker.CP_CHECKED_IN_DEVELOPMENT_VERSION );
getReleaseProgress().checkpoint( basedir.getAbsolutePath(), ReleaseProgressTracker.CP_CHECKED_IN_DEVELOPMENT_VERSION );
}
catch ( IOException e )
{
@ -1281,7 +1281,7 @@ private void checkInNextSnapshot()
private void checkIn( String message )
throws MojoExecutionException
{
ScmHelper scm = getScm( basedir );
ScmHelper scm = getScm( basedir.getAbsolutePath() );
String tag = scm.getTag();
@ -1362,7 +1362,7 @@ private void tagRelease()
try
{
ScmHelper scm = getScm( basedir );
ScmHelper scm = getScm( basedir.getAbsolutePath() );
scm.setTag( tag );
@ -1377,7 +1377,7 @@ private void tagRelease()
try
{
getReleaseProgress().checkpoint( basedir, ReleaseProgressTracker.CP_TAGGED_RELEASE );
getReleaseProgress().checkpoint( basedir.getAbsolutePath(), ReleaseProgressTracker.CP_TAGGED_RELEASE );
}
catch ( IOException e )
{

View File

@ -64,7 +64,7 @@ public class SurefirePlugin
* @parameter expression="${basedir}"
* @required
*/
private String basedir;
private File basedir;
/**
* The directory containing generated classes of the project being tested.
@ -230,7 +230,7 @@ public void execute()
//
// ----------------------------------------------------------------------
System.setProperty( "basedir", basedir );
System.setProperty( "basedir", basedir.getAbsolutePath() );
System.setProperty( "localRepository", localRepository.getBasedir() );

View File

@ -47,7 +47,7 @@ public class VerifierMojo
* @parameter expression="${basedir}"
* @required
*/
private String basedir;
private File basedir;
/**
* @parameter expression="${basedir}/src/test/verifier/verifications.xml"
@ -85,7 +85,7 @@ protected File getAbsoluteFileToCheck( File file )
File result = file;
if ( !file.isAbsolute() )
{
result = new File( new File( this.basedir ), file.getPath() );
result = new File( basedir , file.getPath() );
}
return result;
}
@ -200,7 +200,7 @@ private boolean verifyFileExistence( org.apache.maven.plugin.verifier.model.File
return result;
}
public void setBaseDir( String basedir )
public void setBaseDir( File basedir )
{
this.basedir = basedir;
}