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 "-----------------------------------------------------------------------"
|
echo "-----------------------------------------------------------------------"
|
||||||
|
|
||||||
cd maven-plugins
|
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
|
||||||
)
|
)
|
||||||
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 )
|
public void transformForInstall( Artifact artifact, ArtifactRepository localRepository )
|
||||||
throws ArtifactMetadataRetrievalException
|
throws ArtifactMetadataRetrievalException
|
||||||
{
|
{
|
||||||
// TODO: this is implemented like a SNAPSHOT - it should be at release time only when we have that concept
|
// metadata is added at install time
|
||||||
ReleaseArtifactMetadata metadata = new ReleaseArtifactMetadata( artifact );
|
|
||||||
|
|
||||||
metadata.setVersion( artifact.getVersion() );
|
|
||||||
|
|
||||||
artifact.addMetadata( metadata );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository )
|
public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository )
|
||||||
throws ArtifactMetadataRetrievalException
|
throws ArtifactMetadataRetrievalException
|
||||||
{
|
{
|
||||||
// TODO: this is implemented like a SNAPSHOT - it should be at release time only when we have that concept
|
// metadata is added at deploy time
|
||||||
ReleaseArtifactMetadata metadata = new ReleaseArtifactMetadata( artifact );
|
|
||||||
|
|
||||||
metadata.setVersion( artifact.getVersion() );
|
|
||||||
|
|
||||||
artifact.addMetadata( metadata );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected VersionArtifactMetadata retrieveFromRemoteRepository( Artifact artifact,
|
protected VersionArtifactMetadata retrieveFromRemoteRepository( Artifact artifact,
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
clean:clean
|
-DupdateReleaseInfo=true
|
||||||
install
|
install
|
||||||
it0013:it0013
|
it0013:it0013
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
|
-DupdateReleaseInfo=true
|
||||||
install
|
install
|
||||||
it0015:it0015
|
it0015:it0015
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
|
-DupdateReleaseInfo=true
|
||||||
install
|
install
|
||||||
it0020:it0020
|
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.ArtifactDeployer;
|
||||||
import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
|
import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
|
||||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
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.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
@ -29,11 +30,11 @@ import org.apache.maven.project.artifact.ProjectArtifactMetadata;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Deploys an artifact to remote repository.
|
||||||
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
|
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
|
||||||
* @author <a href="mailto:jdcasey@apache.org">John Casey (refactoring only)</a>
|
* @author <a href="mailto:jdcasey@apache.org">John Casey (refactoring only)</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @goal deploy
|
* @goal deploy
|
||||||
* @description deploys an artifact to remote repository
|
|
||||||
*/
|
*/
|
||||||
public class DeployMojo
|
public class DeployMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -108,6 +109,11 @@ public class DeployMojo
|
||||||
*/
|
*/
|
||||||
private ArtifactRepository localRepository;
|
private ArtifactRepository localRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @parameter expression="${updateReleaseInfo}"
|
||||||
|
*/
|
||||||
|
private boolean updateReleaseInfo = false;
|
||||||
|
|
||||||
public void execute()
|
public void execute()
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
|
@ -128,15 +134,22 @@ public class DeployMojo
|
||||||
artifact.addMetadata( metadata );
|
artifact.addMetadata( metadata );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( updateReleaseInfo )
|
||||||
|
{
|
||||||
|
ReleaseArtifactMetadata metadata = new ReleaseArtifactMetadata( artifact );
|
||||||
|
metadata.setVersion( artifact.getVersion() );
|
||||||
|
artifact.addMetadata( metadata );
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( !isPomArtifact )
|
if ( isPomArtifact )
|
||||||
{
|
{
|
||||||
deployer.deploy( buildDirectory, finalName, artifact, deploymentRepository, localRepository );
|
deployer.deploy( pom, artifact, deploymentRepository, localRepository );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
deployer.deploy( pom, artifact, deploymentRepository, localRepository );
|
deployer.deploy( buildDirectory, finalName, artifact, deploymentRepository, localRepository );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( ArtifactDeploymentException e )
|
catch ( ArtifactDeploymentException e )
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.artifact.DefaultArtifact;
|
import org.apache.maven.artifact.DefaultArtifact;
|
||||||
import org.apache.maven.artifact.installer.ArtifactInstallationException;
|
import org.apache.maven.artifact.installer.ArtifactInstallationException;
|
||||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||||
|
import org.apache.maven.artifact.metadata.ReleaseArtifactMetadata;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.project.artifact.ProjectArtifactMetadata;
|
import org.apache.maven.project.artifact.ProjectArtifactMetadata;
|
||||||
|
|
||||||
|
@ -82,6 +83,11 @@ public class InstallMojo
|
||||||
*/
|
*/
|
||||||
private String finalName;
|
private String finalName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @parameter expression="${updateReleaseInfo}"
|
||||||
|
*/
|
||||||
|
private boolean updateReleaseInfo = false;
|
||||||
|
|
||||||
public void execute()
|
public void execute()
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
|
@ -95,16 +101,23 @@ public class InstallMojo
|
||||||
artifact.addMetadata( metadata );
|
artifact.addMetadata( metadata );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( updateReleaseInfo )
|
||||||
|
{
|
||||||
|
ReleaseArtifactMetadata metadata = new ReleaseArtifactMetadata( artifact );
|
||||||
|
metadata.setVersion( artifact.getVersion() );
|
||||||
|
artifact.addMetadata( metadata );
|
||||||
|
}
|
||||||
|
|
||||||
try
|
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( pom, artifact, localRepository );
|
||||||
installer.install( buildDirectory, finalName, artifact, localRepository );
|
|
||||||
}
|
}
|
||||||
else
|
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 )
|
catch ( ArtifactInstallationException e )
|
||||||
|
|
|
@ -66,7 +66,8 @@ public class PerformReleaseMojo
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
// TODO: we need to get a reference to the maven component and use that so this
|
// 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();
|
Commandline cl = new Commandline();
|
||||||
|
|
||||||
|
@ -76,6 +77,8 @@ public class PerformReleaseMojo
|
||||||
|
|
||||||
cl.createArgument().setLine( goals );
|
cl.createArgument().setLine( goals );
|
||||||
|
|
||||||
|
cl.createArgument().setLine( "-DupdateReleaseInfo=true" );
|
||||||
|
|
||||||
StreamConsumer consumer = new DefaultConsumer();
|
StreamConsumer consumer = new DefaultConsumer();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -248,6 +248,7 @@ public class PrepareReleaseMojo
|
||||||
|
|
||||||
releaseProperties.setProperty( "version", projectVersion );
|
releaseProperties.setProperty( "version", projectVersion );
|
||||||
|
|
||||||
|
// TODO: fix
|
||||||
releaseProperties.setProperty( USERNAME, username );
|
releaseProperties.setProperty( USERNAME, username );
|
||||||
|
|
||||||
releaseProperties.setProperty( TAG, getTagLabel() );
|
releaseProperties.setProperty( TAG, getTagLabel() );
|
||||||
|
|
Loading…
Reference in New Issue