[ 
https://issues.apache.org/jira/browse/MINSTALL-156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16760268#comment-16760268
 ] 

Witold Markowski edited comment on MINSTALL-156 at 2/4/19 10:29 PM:
--------------------------------------------------------------------

This behavior may be an expected behavior. It looks like *3.0.0-M1* will 
install *pom* file always, if the *pom* is available from the inside of the 
installed *jar* file. When the artifact is built by Maven, it will put the 
*pom* in the *META-INF* directory inside of the jar. This *pom* file will be 
installed always no matter what *generatePom* says.

However *generatePom* comes into action when you want to install a *jar* file 
which doesn't contain any *META-INF* inside. [~robert12345], please do a simple 
test:
 * delete whole *META-INF* from the inside of your 
*target/test1-1.0-SNAPSHOT.jar*
 * execute *mvn 
org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file 
-Dfile=target/test1-1.0-SNAPSHOT.jar -DgroupId=test1 -DartifactId=test1 
-Dversion=1.0-SNAPSHOT -Dpackaging=jar -DgeneratePom=false*

In my test *pom* file is not generated by *maven-install-plugin* as below:
{noformat}
$ mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file 
-Dfile=target/test1-1.0-SNAPSHOT.jar -DgroupId=test1 -DartifactId=test1 
-Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dgene ratePom=false
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building test1 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:3.0.0-M1:install-file (default-cli) @ test1 ---
[INFO] pom.xml not found in test1-1.0-SNAPSHOT.jar
[INFO] Installing 
C:\Users\wmarkowski\dev-test\sources\test1\target\test1-1.0-SNAPSHOT.jar to 
C:\Users\wmarkowski\.m2\repository\test1\test1\1.0-SNAPSHOT\test1-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.730 s
[INFO] Finished at: 2019-02-04T23:13:56+01:00
[INFO] Final Memory: 9M/245M
[INFO] ------------------------------------------------------------------------
{noformat}

>From the other hand, this behavior may break the back compatibility with 
>*2.5.2* version, where it was possible to *NOT* to install *pom*. The question 
>is: does *3.0.0-M1* need to be as much back compatible with *2.5.2*? Second 
>thing: it seems to be a good idea to have *pom* as well installed; maven will 
>have then all information about dependencies used by the installed *jar*.


was (Author: wmarkow):
This behavior may be an expected behavior. It looks like *3.0.0-M1* will 
install *pom* file always, if the *pom* is available from the inside of the 
installed *jar* file. When the artifact is built by Maven, it will put the 
*pom* in the *META-INF* directory inside of the jar. This *pom* file will be 
installed always no matter what *generatePom* says.

However *generatePom* comes into action when you want to install a *jar* file 
which doesn't contain any *META-INF* inside. [~robert12345], please do a simple 
test:
 * delete whole *META-INF* from the inside of your 
*target/test1-1.0-SNAPSHOT.jar*
 * execute *mvn 
org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file 
-Dfile=target/test1-1.0-SNAPSHOT.jar -DgroupId=test1 -DartifactId=test1 
-Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dgene ratePom=false*

In my test *pom* file is not generated by *maven-install-plugin* as below:
{noformat}
$ mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file 
-Dfile=target/test1-1.0-SNAPSHOT.jar -DgroupId=test1 -DartifactId=test1 
-Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dgene ratePom=false
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building test1 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:3.0.0-M1:install-file (default-cli) @ test1 ---
[INFO] pom.xml not found in test1-1.0-SNAPSHOT.jar
[INFO] Installing 
C:\Users\wmarkowski\dev-test\sources\test1\target\test1-1.0-SNAPSHOT.jar to 
C:\Users\wmarkowski\.m2\repository\test1\test1\1.0-SNAPSHOT\test1-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.730 s
[INFO] Finished at: 2019-02-04T23:13:56+01:00
[INFO] Final Memory: 9M/245M
[INFO] ------------------------------------------------------------------------
{noformat}

>From the other hand, this behavior may break the back compatibility with 
>*2.5.2* version, where it was possible to *NOT* to install *pom*. The question 
>is: does *3.0.0-M1* need to be as much back compatible with *2.5.2*? Second 
>thing: it seems to be a good idea to have *pom* as well installed; maven will 
>have then all information about dependencies used by the installed *jar*.

> generatePom=false not working with 3.0.0-M1
> -------------------------------------------
>
>                 Key: MINSTALL-156
>                 URL: https://issues.apache.org/jira/browse/MINSTALL-156
>             Project: Maven Install Plugin
>          Issue Type: Bug
>    Affects Versions: 3.0.0-M1
>            Reporter: Robert Lieske
>            Priority: Major
>
> Steps to reproduce:
> {{mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes 
> -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 
> -DgroupId=test1 -DartifactId=test1 -Dversion=1.0-SNAPSHOT}}
>  
> {{mvn clean package install:install-file -Dfile=target/test1-1.0-SNAPSHOT.jar 
> -DgeneratePom=false}}
> produces:
> {quote}[INFO] --- maven-install-plugin:2.5.2:install-file (default-cli) @ 
> test1 ---
> [INFO] Installing D:\Workarea\sample\test1\target\test1-1.0-SNAPSHOT.jar to 
> C:\Users\xxx\.m2\repository\test1\test1\1.0-SNAPSHOT\test1-1.0-SNAPSHOT.jar
> [INFO] 
> ------------------------------------------------------------------------
> {quote}
>  
> changing the version of the maven-install-plugin in pom.xml to 
> {{<plugin>}}
> {{ <artifactId>maven-install-plugin</artifactId>}}
> {{ <version>3.0.0-M1</version>}}
> {{ </plugin>}}
>  
> the same call to
> {{mvn clean package install:install-file -Dfile=target/test1-1.0-SNAPSHOT.jar 
> -DgeneratePom=false}}
> produces:
> {quote}[INFO] --- maven-install-plugin:3.0.0-M1:install-file (default-cli) @ 
> test1 ---
> [INFO] Installing D:\Workarea\sample\test1\target\test1-1.0-SNAPSHOT.jar to 
> C:\Users\xxx\.m2\repository\test1\test1\1.0-SNAPSHOT\test1-1.0-SNAPSHOT.jar
> [INFO] Installing 
> C:\Users\xxx\AppData\Local\Temp\test1-1.0-SNAPSHOT7157743325898943802.pom to 
> C:\Users\xxx\.m2\repository\test1\test1\1.0-SNAPSHOT\test1-1.0-SNAPSHOT.pom
> [INFO] 
> ------------------------------------------------------------------------
> {quote}
>  
> Which also installs a POM - which is not what we want!
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to