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

Christian Kohlschütter commented on MINSTALL-201:
-------------------------------------------------

Thanks for the clarification!

The declaration of the jar plugin is in a parent POM that is supposed to be 
applied for any subprojects. This had worked until version 3.1.1. Such a change 
in behavior in a patch-level release is very unexpected, and also not declared 
in the change log.

I'm not arguing that this should be correct behavior, it just happened to be 
the previous one.

I have fixed my configuration by adding a profile that disables the 
maven-jar-plugin as much as possible for POM artifacts, as follows:
{code:java}
     <profile>
            <id>disable-jar-plugin-for-pom</id>
            <activation>
                <property>
                    <name>packaging</name>
                    <value>pom</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <configuration>
                            <skipIfEmpty>true</skipIfEmpty>
                            <classifier>disabled</classifier><!-- just in case 
-->
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>{code}
There's no "skip" configuration attribute in maven-jar-plugin, so we use 
"skipIfEmpty", which should always be true for POM artifacts. In case that 
assumption does not hold true, we specify a classifier for that artifact so the 
POM file does not get overwritten by an archive.

I assume the second part will no longer be necessary in version 3.1.3 because 
it would fail, right?

> Regression in 3.1.2 when installing pom artifact
> ------------------------------------------------
>
>                 Key: MINSTALL-201
>                 URL: https://issues.apache.org/jira/browse/MINSTALL-201
>             Project: Maven Install Plugin
>          Issue Type: Bug
>    Affects Versions: 3.1.2
>         Environment: macOS 14.5, Maven 3.9.8; probably any
>            Reporter: Christian Kohlschütter
>            Priority: Blocker
>
> With 3.1.2, I'm seeing wrong artifact metadata (POM files) being installed 
> for POM-packaged artifacts in a multi-module project.
> Prior to 3.1.2, we were excluding some operations in InstallMojo.java when a 
> project's packaging was "pom". The check got removed, leading to ".pom" 
> artifact files being installed as some sort of zip file (yet having the 
> ".pom" file suffix).
> This breaks all sorts of things for me, effectively rendering version 3.1.2 
> unusable.
> Patch forthcoming.
> To reproduce:
> {code:java}
> git clone g...@github.com:kohlschutter/kohlschutter-parent.git
> git checkout kohlschutter-parent-1.7.2
> cd kohlschutter-parent
> mvn clean install -Dignorant -DskipTests
> file 
> $HOME/.m2/repository/com/kohlschutter/kohlschutter-parent-multirelease/1.7.2/kohlschutter-parent-multirelease-1.7.2.pom
> # the above command should return something like "XML 1.0 document text, 
> ASCII text"
> # 
> # now change maven-install-plugin dependency version in kohlschutter-parent's 
> pom.xml from 3.1.1 to 3.1.2
> mvn clean install -Dignorant -DskipTests
> file 
> $HOME/.m2/repository/com/kohlschutter/kohlschutter-parent-multirelease/1.7.2/kohlschutter-parent-multirelease-1.7.2.pom
> # 
> # the above command now returns something like "Zip archive data, at least 
> v1.0 to extract, compression method=store"
> # 
> # contents of the zip file:
> # META-INF/
> # META-INF/MANIFEST.MF
> # META-INF/maven/
> # META-INF/maven/com.kohlschutter/
> # META-INF/maven/com.kohlschutter/kohlschutter-parent-multirelease/
> # META-INF/maven/com.kohlschutter/kohlschutter-parent-multirelease/pom.xml
> # 
> META-INF/maven/com.kohlschutter/kohlschutter-parent-multirelease/pom.properties}}
>  {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to