You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ar...@apache.org on 2006/02/21 08:00:49 UTC
svn commit: r379380 -
/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java
Author: aramirez
Date: Mon Feb 20 23:00:49 2006
New Revision: 379380
URL: http://svn.apache.org/viewcvs?rev=379380&view=rev
Log:
PR: MDEPLOY-21
-fixed the deletion of the pom artifact when deploying from the local repository
Modified:
maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java
Modified: maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java?rev=379380&r1=379379&r2=379380&view=diff
==============================================================================
--- maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java (original)
+++ maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java Mon Feb 20 23:00:49 2006
@@ -137,24 +137,33 @@
initProperties();
+ Artifact pomArtifact = null;
+
try
{
// Create the artifact
Artifact artifact = artifactFactory.createArtifact( groupId, artifactId, version, null, packaging );
-
+
ArtifactRepository deploymentRepository = repositoryFactory
.createDeploymentArtifactRepository( repositoryId, url, layout, false );
// Upload the POM if requested, generating one if need be
if ( generatePom )
{
- if ( null == pomFile )
+ if ( !isPomFileExisting() )
{
generatePomFile();
}
ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, pomFile );
artifact.addMetadata( metadata );
}
+ else
+ {
+ if( isPomFileExisting() )
+ {
+ pomArtifact = artifactFactory.createArtifact( groupId, artifactId, version, null, "pom" );
+ }
+ }
if ( !file.exists() )
{
@@ -168,12 +177,27 @@
throw new MojoExecutionException( "No transfer protocol found." );
}
getDeployer().deploy( file, artifact, deploymentRepository, getLocalRepository() );
+
+ if( isPomFileExisting() && generatePom == false )
+ {
+ getDeployer().deploy( pomFile, pomArtifact, deploymentRepository, getLocalRepository() );
+ }
}
catch ( ArtifactDeploymentException e )
{
throw new MojoExecutionException( e.getMessage(), e );
}
}
+
+ private boolean isPomFileExisting()
+ {
+ boolean existing = false;
+ if( pomFile != null && pomFile.exists() )
+ {
+ existing = true;
+ }
+ return existing;
+ }
void initProperties()
throws MojoExecutionException
@@ -181,6 +205,8 @@
// Process the supplied POM (if there is one)
if ( pomFile != null )
{
+ generatePom = false;
+
Model model = readModel( pomFile );
processModel( model );