mirror of https://github.com/apache/maven.git
PR: MNG-378
Only deploy the release information at the point of release git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@177934 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fa3ecc6bd6
commit
48cf14a656
|
@ -50,7 +50,8 @@ ret=$?; if [ $ret != 0 ]; then exit $ret; fi
|
|||
echo "-----------------------------------------------------------------------"
|
||||
|
||||
cd maven-plugins
|
||||
m2 -e --update-snapshots clean:clean install
|
||||
# update the release info to ensure these versions get used in the integration tests
|
||||
m2 -DupdateReleaseInfo=true -e --update-snapshots clean:clean install
|
||||
ret=$?; if [ $ret != 0 ]; then exit $ret; fi
|
||||
)
|
||||
ret=$?; if [ $ret != 0 ]; then exit $ret; fi
|
||||
|
|
|
@ -61,23 +61,13 @@ public class ReleaseArtifactTransformation
|
|||
public void transformForInstall( Artifact artifact, ArtifactRepository localRepository )
|
||||
throws ArtifactMetadataRetrievalException
|
||||
{
|
||||
// TODO: this is implemented like a SNAPSHOT - it should be at release time only when we have that concept
|
||||
ReleaseArtifactMetadata metadata = new ReleaseArtifactMetadata( artifact );
|
||||
|
||||
metadata.setVersion( artifact.getVersion() );
|
||||
|
||||
artifact.addMetadata( metadata );
|
||||
// metadata is added at install time
|
||||
}
|
||||
|
||||
public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository )
|
||||
throws ArtifactMetadataRetrievalException
|
||||
{
|
||||
// TODO: this is implemented like a SNAPSHOT - it should be at release time only when we have that concept
|
||||
ReleaseArtifactMetadata metadata = new ReleaseArtifactMetadata( artifact );
|
||||
|
||||
metadata.setVersion( artifact.getVersion() );
|
||||
|
||||
artifact.addMetadata( metadata );
|
||||
// metadata is added at deploy time
|
||||
}
|
||||
|
||||
protected VersionArtifactMetadata retrieveFromRemoteRepository( Artifact artifact,
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
clean:clean
|
||||
-DupdateReleaseInfo=true
|
||||
install
|
||||
it0013:it0013
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
-DupdateReleaseInfo=true
|
||||
install
|
||||
it0015:it0015
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
-DupdateReleaseInfo=true
|
||||
install
|
||||
it0020:it0020
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.apache.maven.artifact.DefaultArtifact;
|
|||
import org.apache.maven.artifact.deployer.ArtifactDeployer;
|
||||
import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||
import org.apache.maven.artifact.metadata.ReleaseArtifactMetadata;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
|
@ -29,11 +30,11 @@ import org.apache.maven.project.artifact.ProjectArtifactMetadata;
|
|||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Deploys an artifact to remote repository.
|
||||
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
|
||||
* @author <a href="mailto:jdcasey@apache.org">John Casey (refactoring only)</a>
|
||||
* @version $Id$
|
||||
* @goal deploy
|
||||
* @description deploys an artifact to remote repository
|
||||
*/
|
||||
public class DeployMojo
|
||||
extends AbstractMojo
|
||||
|
@ -108,6 +109,11 @@ public class DeployMojo
|
|||
*/
|
||||
private ArtifactRepository localRepository;
|
||||
|
||||
/**
|
||||
* @parameter expression="${updateReleaseInfo}"
|
||||
*/
|
||||
private boolean updateReleaseInfo = false;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
|
@ -128,15 +134,22 @@ public class DeployMojo
|
|||
artifact.addMetadata( metadata );
|
||||
}
|
||||
|
||||
if ( updateReleaseInfo )
|
||||
{
|
||||
ReleaseArtifactMetadata metadata = new ReleaseArtifactMetadata( artifact );
|
||||
metadata.setVersion( artifact.getVersion() );
|
||||
artifact.addMetadata( metadata );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if ( !isPomArtifact )
|
||||
if ( isPomArtifact )
|
||||
{
|
||||
deployer.deploy( buildDirectory, finalName, artifact, deploymentRepository, localRepository );
|
||||
deployer.deploy( pom, artifact, deploymentRepository, localRepository );
|
||||
}
|
||||
else
|
||||
{
|
||||
deployer.deploy( pom, artifact, deploymentRepository, localRepository );
|
||||
deployer.deploy( buildDirectory, finalName, artifact, deploymentRepository, localRepository );
|
||||
}
|
||||
}
|
||||
catch ( ArtifactDeploymentException e )
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.apache.maven.artifact.Artifact;
|
|||
import org.apache.maven.artifact.DefaultArtifact;
|
||||
import org.apache.maven.artifact.installer.ArtifactInstallationException;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||
import org.apache.maven.artifact.metadata.ReleaseArtifactMetadata;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.project.artifact.ProjectArtifactMetadata;
|
||||
|
||||
|
@ -82,6 +83,11 @@ public class InstallMojo
|
|||
*/
|
||||
private String finalName;
|
||||
|
||||
/**
|
||||
* @parameter expression="${updateReleaseInfo}"
|
||||
*/
|
||||
private boolean updateReleaseInfo = false;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
|
@ -95,16 +101,23 @@ public class InstallMojo
|
|||
artifact.addMetadata( metadata );
|
||||
}
|
||||
|
||||
if ( updateReleaseInfo )
|
||||
{
|
||||
ReleaseArtifactMetadata metadata = new ReleaseArtifactMetadata( artifact );
|
||||
metadata.setVersion( artifact.getVersion() );
|
||||
artifact.addMetadata( metadata );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if ( !isPomArtifact )
|
||||
if ( isPomArtifact )
|
||||
{
|
||||
// TODO: would be something nice to get back from the project to get the full filename (the OGNL feedback thing)
|
||||
installer.install( buildDirectory, finalName, artifact, localRepository );
|
||||
installer.install( pom, artifact, localRepository );
|
||||
}
|
||||
else
|
||||
{
|
||||
installer.install( pom, artifact, localRepository );
|
||||
// TODO: would be something nice to get back from the project to get the full filename (the OGNL feedback thing)
|
||||
installer.install( buildDirectory, finalName, artifact, localRepository );
|
||||
}
|
||||
}
|
||||
catch ( ArtifactInstallationException e )
|
||||
|
|
|
@ -66,7 +66,8 @@ public class PerformReleaseMojo
|
|||
throws MojoExecutionException
|
||||
{
|
||||
// TODO: we need to get a reference to the maven component and use that so this
|
||||
// will work purely in an embedded mode.
|
||||
// will work purely in an embedded mode. Not sure how to pass the release setting to the plugin in that
|
||||
// instance though - still via -D, or is there a better way?
|
||||
|
||||
Commandline cl = new Commandline();
|
||||
|
||||
|
@ -76,6 +77,8 @@ public class PerformReleaseMojo
|
|||
|
||||
cl.createArgument().setLine( goals );
|
||||
|
||||
cl.createArgument().setLine( "-DupdateReleaseInfo=true" );
|
||||
|
||||
StreamConsumer consumer = new DefaultConsumer();
|
||||
|
||||
try
|
||||
|
|
|
@ -248,6 +248,7 @@ public class PrepareReleaseMojo
|
|||
|
||||
releaseProperties.setProperty( "version", projectVersion );
|
||||
|
||||
// TODO: fix
|
||||
releaseProperties.setProperty( USERNAME, username );
|
||||
|
||||
releaseProperties.setProperty( TAG, getTagLabel() );
|
||||
|
|
Loading…
Reference in New Issue