mirror of https://github.com/apache/maven.git
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:
parent
91b4c4e604
commit
14b9e9f347
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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,11 +189,15 @@ public class DefaultLifecycleExecutor
|
|||
plugin.setArtifactId( artifactId );
|
||||
plugin.setVersion( version );
|
||||
|
||||
Plugin def = (Plugin) project.getPluginManagement().getPluginsAsMap().get( key );
|
||||
PluginManagement pluginManagement = project.getPluginManagement();
|
||||
if ( pluginManagement != null )
|
||||
{
|
||||
Plugin def = (Plugin) pluginManagement.getPluginsAsMap().get( key );
|
||||
if ( def != null )
|
||||
{
|
||||
modelDefaultsInjector.mergePluginWithDefaults( plugin, def );
|
||||
}
|
||||
}
|
||||
|
||||
project.addPlugin( plugin );
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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}"
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue