remove default plugin versions from super POM, rely on discovery of releases. Write out the current version during bootstrap to force its usage (unfortunately enforcing it on other installs, however...)

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@169484 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-05-10 15:04:06 +00:00
parent 91b4c4e604
commit 14b9e9f347
8 changed files with 37 additions and 79 deletions

View File

@ -22,6 +22,7 @@ import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
import org.apache.maven.artifact.metadata.VersionArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactPathFormatException;
import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import java.io.File;
@ -107,7 +108,7 @@ public abstract class AbstractVersionTransformation
getLogger().info(
artifact.getArtifactId() + ": checking for updates from " + remoteRepository.getId() );
VersionArtifactMetadata remoteMetadata = retrieveFromRemoteRepository( artifact, remoteRepository );
VersionArtifactMetadata remoteMetadata = retrieveFromRemoteRepository( artifact, remoteRepository, localMetadata );
int difference = remoteMetadata.compareTo( localMetadata );
if ( difference > 0 )
@ -171,7 +172,8 @@ public abstract class AbstractVersionTransformation
}
protected abstract VersionArtifactMetadata retrieveFromRemoteRepository( Artifact artifact,
ArtifactRepository remoteRepository )
ArtifactRepository remoteRepository,
VersionArtifactMetadata localMetadata )
throws ArtifactMetadataRetrievalException;
protected abstract VersionArtifactMetadata readFromLocalRepository( Artifact artifact,

View File

@ -81,7 +81,8 @@ public class ReleaseArtifactTransformation
}
protected VersionArtifactMetadata retrieveFromRemoteRepository( Artifact artifact,
ArtifactRepository remoteRepository )
ArtifactRepository remoteRepository,
VersionArtifactMetadata localMetadata )
throws ArtifactMetadataRetrievalException
{
AbstractVersionArtifactMetadata metadata = new ReleaseArtifactMetadata( artifact );
@ -91,7 +92,11 @@ public class ReleaseArtifactTransformation
}
catch ( ResourceDoesNotExistException e )
{
throw new ArtifactMetadataRetrievalException( "No releases could be detected for the artifact", e );
if ( localMetadata.constructVersion() == null )
{
throw new ArtifactMetadataRetrievalException( "Unable to find release for artifact " + artifact, e );
}
// otherwise, ignore - use the local one
}
return metadata;
}

View File

@ -25,7 +25,6 @@ import org.apache.maven.artifact.repository.layout.ArtifactPathFormatException;
import org.apache.maven.wagon.ResourceDoesNotExistException;
import java.io.IOException;
import java.io.File;
import java.util.List;
import java.util.regex.Matcher;
@ -94,8 +93,8 @@ public class SnapshotTransformation
}
else if ( isSnapshot( artifact ) )
{
SnapshotArtifactMetadata metadata = (SnapshotArtifactMetadata) retrieveFromRemoteRepository( artifact,
remoteRepository );
SnapshotArtifactMetadata metadata = null;
metadata = (SnapshotArtifactMetadata) retrieveFromRemoteRepository( artifact, remoteRepository, null );
metadata.update();
artifact.setVersion( metadata.constructVersion() );
@ -110,7 +109,8 @@ public class SnapshotTransformation
}
protected VersionArtifactMetadata retrieveFromRemoteRepository( Artifact artifact,
ArtifactRepository remoteRepository )
ArtifactRepository remoteRepository,
VersionArtifactMetadata localMetadata )
throws ArtifactMetadataRetrievalException
{
SnapshotArtifactMetadata metadata = new SnapshotArtifactMetadata( artifact );

View File

@ -23,6 +23,7 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.execution.MavenExecutionResponse;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginManagement;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.PluginManager;
import org.apache.maven.plugin.PluginManagerException;
@ -188,10 +189,14 @@ public class DefaultLifecycleExecutor
plugin.setArtifactId( artifactId );
plugin.setVersion( version );
Plugin def = (Plugin) project.getPluginManagement().getPluginsAsMap().get( key );
if ( def != null )
PluginManagement pluginManagement = project.getPluginManagement();
if ( pluginManagement != null )
{
modelDefaultsInjector.mergePluginWithDefaults( plugin, def );
Plugin def = (Plugin) pluginManagement.getPluginsAsMap().get( key );
if ( def != null )
{
modelDefaultsInjector.mergePluginWithDefaults( plugin, def );
}
}
project.addPlugin( plugin );

View File

@ -636,8 +636,6 @@ public class MBoot
installPom( basedir, localRepository, reader );
String artifactId = reader.getArtifactId();
install( basedir, localRepository, reader, reader.getPackaging() );
return reader;
@ -742,7 +740,6 @@ public class MBoot
throws Exception
{
installPomFile( reader, localRepository, new File( basedir, "pom.xml" ) );
}
private void installPomFile( ModelReader reader, Repository localRepository, File source )
@ -789,6 +786,8 @@ public class MBoot
FileUtils.copyFile( new File( basedir, BUILD_DIR + "/" + finalName + ".jar" ), file );
file = localRepository.getMetadataFile( groupId, artifactId, null, type, artifactId + "-RELEASE.version.txt" );
IOUtil.copy( new StringReader( version ), new FileWriter( file ) );
}
private void runTests( String basedir, String classes, String testClasses, ModelReader reader,
@ -807,7 +806,7 @@ public class MBoot
excludes = new ArrayList();
excludes.add( "**/*Abstract*.java" );
excludes.add( "**/Abstract*Test.java" );
String reportsDir = new File( basedir, "target/surefire-reports" ).getAbsolutePath();

View File

@ -107,7 +107,11 @@ public class Repository
repositoryPath = dependency.getGroupId().replace( '.', '/' );
// if ( !dependency.getType().equals( "pom" ) )
// {
repositoryPath = repositoryPath + "/" + dependency.getArtifactId() + "/" + dependency.getVersion();
repositoryPath = repositoryPath + "/" + dependency.getArtifactId();
if ( version != null )
{
repositoryPath = repositoryPath + "/" + dependency.getVersion();
}
// }
repositoryPath = repositoryPath + "/" + filename;
}

View File

@ -25,6 +25,7 @@ import org.codehaus.surefire.SurefireBooter;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
@ -83,12 +84,12 @@ public class SurefirePlugin
/**
* @parameter
*/
private List includes;
private List includes = new ArrayList( Collections.singletonList( "**/*Test.java" ) );
/**
* @parameter
*/
private List excludes;
private List excludes = new ArrayList( Collections.singletonList( "**/Abstract*Test.java" ) );
/**
* @parameter expression="${localRepository}"

View File

@ -38,64 +38,6 @@
<directory>src/test/resources</directory>
</testResource>
</testResources>
<!-- Default plugins -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
<configuration>
<includes>
<include implementation="java.lang.String">**/*Test.java</include>
</includes>
<excludes>
<exclude implementation="java.lang.String">**/Abstract*Test.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pom-plugin</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>