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/19 13:58:31 UTC
[maven-install-plugin] branch master updated: [MINSTALL-160] Generated POM is not installed if original POM exists (#36)
This is an automated email from the ASF dual-hosted git repository.
cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-install-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 23ab053 [MINSTALL-160] Generated POM is not installed if original POM exists (#36)
23ab053 is described below
commit 23ab0535647d38efee5defe56b458b93d65a4ad3
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Tue Jul 19 15:58:26 2022 +0200
[MINSTALL-160] Generated POM is not installed if original POM exists (#36)
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/it/MINSTALL-52/verify.groovy | 3 ++-
.../java/org/apache/maven/plugins/install/InstallFileMojo.java | 8 ++++++--
.../org/apache/maven/plugins/install/InstallFileMojoTest.java | 6 ------
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/it/MINSTALL-52/verify.groovy b/src/it/MINSTALL-52/verify.groovy
index 21f7323..617b5ae 100644
--- a/src/it/MINSTALL-52/verify.groovy
+++ b/src/it/MINSTALL-52/verify.groovy
@@ -22,4 +22,5 @@ assert new File( basedir, "../../local-repo/org/apache/maven/plugins/install/its
File buildLog = new File( basedir, 'build.log' )
assert buildLog.exists()
-assert buildLog.text.contains( "[DEBUG] Using META-INF/maven/org.apache.maven.plugins.install.its/minstall52/pom.xml as pomFile" )
+assert buildLog.text.contains( "[DEBUG] Loading META-INF/maven/org.apache.maven.plugins.install.its/minstall52/pom.xml" )
+assert buildLog.text.contains( "[DEBUG] Using JAR embedded POM as pomFile" )
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..a006dac 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,11 @@ public class InstallFileMojo
else
{
temporaryPom = readingPomFromJarFile();
- pomFile = temporaryPom;
+ if ( !Boolean.TRUE.equals( generatePom ) )
+ {
+ pomFile = temporaryPom;
+ getLog().debug( "Using JAR embedded POM as pomFile" );
+ }
}
if ( groupId == null || artifactId == null || version == null || packaging == null )
@@ -322,7 +326,7 @@ public class InstallFileMojo
if ( pomEntry.matcher( entry.getName() ).matches() )
{
- getLog().debug( "Using " + entry.getName() + " as pomFile" );
+ getLog().debug( "Loading " + entry.getName() );
InputStream pomInputStream = null;
OutputStream pomOutputStream = 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 );