You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2026/09/23 21:44:37 UTC
(maven-install-plugin) branch fix/315-pom-packaged-jar-jar-installs-zip created (now 9b9409c)
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a change to branch fix/315-pom-packaged-jar-jar-installs-zip
in repository https://gitbox.apache.org/repos/asf/maven-install-plugin.git
at 9b9409c Add IT for MINSTALL-315: pom-packaged project with jar:jar then install:install
This branch includes the following new commits:
new 9b9409c Add IT for MINSTALL-315: pom-packaged project with jar:jar then install:install
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(maven-install-plugin) 01/01: Add IT for MINSTALL-315: pom-packaged project with jar:jar then install:install
Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch fix/315-pom-packaged-jar-jar-installs-zip
in repository https://gitbox.apache.org/repos/asf/maven-install-plugin.git
commit 9b9409c561a26308c9c9ac7c6001eb17d9a6d95e
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Wed Sep 23 21:44:15 2026 +0000
Add IT for MINSTALL-315: pom-packaged project with jar:jar then install:install
Regression test: when jar:jar is run on a pom-packaged project (setting
project.getArtifact().getFile() to the produced JAR), a subsequent install:install
must install the POM — not the JAR — in the local repository.
Requires the fix in DefaultArtifactManager.getPath() in Maven core.
---
.../invoker.properties | 20 +++++++++
src/it/minstall-315-pom-packaged-jar-jar/pom.xml | 50 ++++++++++++++++++++++
.../minstall-315-pom-packaged-jar-jar/setup.groovy | 29 +++++++++++++
.../verify.groovy | 42 ++++++++++++++++++
4 files changed, 141 insertions(+)
diff --git a/src/it/minstall-315-pom-packaged-jar-jar/invoker.properties b/src/it/minstall-315-pom-packaged-jar-jar/invoker.properties
new file mode 100644
index 0000000..2dedb6d
--- /dev/null
+++ b/src/it/minstall-315-pom-packaged-jar-jar/invoker.properties
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Run jar:jar first (sets project.getArtifact().getFile() to the produced JAR even though
+# this is a pom-packaged project), then install:install — which must install the POM, not the JAR.
+invoker.goals = jar:jar install:install
diff --git a/src/it/minstall-315-pom-packaged-jar-jar/pom.xml b/src/it/minstall-315-pom-packaged-jar-jar/pom.xml
new file mode 100644
index 0000000..64cde5c
--- /dev/null
+++ b/src/it/minstall-315-pom-packaged-jar-jar/pom.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.install.minstall315</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0</version>
+ <packaging>pom</packaging>
+
+ <description>Regression test for MINSTALL-315: when jar:jar is run on a pom-packaged project followed by
+ install:install, the POM must be installed in the local repository — not the JAR produced by jar:jar.</description>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>@version.maven-jar-plugin@</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/src/it/minstall-315-pom-packaged-jar-jar/setup.groovy b/src/it/minstall-315-pom-packaged-jar-jar/setup.groovy
new file mode 100644
index 0000000..4e69b86
--- /dev/null
+++ b/src/it/minstall-315-pom-packaged-jar-jar/setup.groovy
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.*;
+import java.util.*;
+
+import org.codehaus.plexus.util.*;
+
+File file = new File( localRepositoryPath, "org/apache/maven/its/install/minstall315" );
+System.out.println( "Deleting " + file );
+FileUtils.deleteDirectory( file );
+
+return true;
diff --git a/src/it/minstall-315-pom-packaged-jar-jar/verify.groovy b/src/it/minstall-315-pom-packaged-jar-jar/verify.groovy
new file mode 100644
index 0000000..1bd29dd
--- /dev/null
+++ b/src/it/minstall-315-pom-packaged-jar-jar/verify.groovy
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.*;
+import java.util.*;
+
+String groupPath = "org/apache/maven/its/install/minstall315/test/1.0";
+
+// The POM must be present in the local repository
+File pom = new File( localRepositoryPath, groupPath + "/test-1.0.pom" );
+System.out.println( "Checking for POM: " + pom );
+assert pom.isFile() : "POM must be installed: " + pom;
+
+// The installed file must be an XML/POM, not a JAR.
+// ZIP/JAR files start with magic bytes 0x50 0x4B ("PK").
+byte[] magic = new byte[2];
+pom.withInputStream { is -> is.read( magic ) }
+assert !(magic[0] == 0x50 && magic[1] == 0x4b) :
+ "Installed artifact must be a POM (XML), not a JAR (ZIP). MINSTALL-315 regression detected!"
+
+// No JAR should have been installed at the POM coordinates
+File jar = new File( localRepositoryPath, groupPath + "/test-1.0.jar" );
+System.out.println( "Checking JAR is absent: " + jar );
+assert !jar.isFile() : "No JAR should be installed for a pom-packaged project: " + jar;
+
+return true;