You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2022/07/18 12:54:50 UTC

[maven-install-plugin] 01/01: [MINSTALL-160] Generated POM is not installed if original POM exists

This is an automated email from the ASF dual-hosted git repository.

cstamas pushed a commit to branch MINSTALL-160
in repository https://gitbox.apache.org/repos/asf/maven-install-plugin.git

commit cdee558b50307da43eed07909d235639a98974f9
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Mon Jul 18 14:52:37 2022 +0200

    [MINSTALL-160] Generated POM is not installed if original POM exists
    
    When using `generatePom=true` with install-file Mojo, it will despite
    this copy existing POM if it is found embedded in JAR (and if it
    was built with Maven, it will find it).
    
    The generatePom should reuse POM values embedded from JAR
    but should generate (and install) new "empty POM" instead.
---
 src/main/java/org/apache/maven/plugins/install/InstallFileMojo.java | 1 -
 .../java/org/apache/maven/plugins/install/InstallFileMojoTest.java  | 6 ------
 2 files changed, 7 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/install/InstallFileMojo.java b/src/main/java/org/apache/maven/plugins/install/InstallFileMojo.java
index aab859f..eec84ab 100644
--- a/src/main/java/org/apache/maven/plugins/install/InstallFileMojo.java
+++ b/src/main/java/org/apache/maven/plugins/install/InstallFileMojo.java
@@ -206,7 +206,6 @@ public class InstallFileMojo
         else
         {
             temporaryPom = readingPomFromJarFile();
-            pomFile = temporaryPom;
         }
 
         if ( groupId == null || artifactId == null || version == null || packaging == null )
diff --git a/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java b/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java
index c135d95..7efd90c 100644
--- a/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java
@@ -92,9 +92,6 @@ public class InstallFileMojoTest
         assignValuesForParameter( mojo );
 
         mojo.execute();
-        
-        File pomFile = (File) getVariableValueFromObject( mojo, "pomFile" );
-        org.codehaus.plexus.util.FileUtils.forceDelete( pomFile );
 
         File installedArtifact = new File( getBasedir(), LOCAL_REPO + groupId + "/" + artifactId + "/" + version + "/" +
             artifactId + "-" + version + "." + packaging );
@@ -122,9 +119,6 @@ public class InstallFileMojoTest
 
         mojo.execute();
 
-        File pomFile = (File) getVariableValueFromObject( mojo, "pomFile" );
-        org.codehaus.plexus.util.FileUtils.forceDelete( pomFile );
-
         File installedArtifact = new File( getBasedir(), LOCAL_REPO + groupId + "/" + artifactId + "/" + version + "/" +
             artifactId + "-" + version + "-" + classifier + "." + packaging );