[Git][java-team/maven-bundle-plugin][upstream] 3 commits: New upstream version 6.1.0

Emmanuel Bourg (@ebourg) gitlab at salsa.debian.org
Sun Nov 22 23:12:46 GMT 2026



Emmanuel Bourg pushed to branch upstream at Debian Java Maintainers / maven-bundle-plugin


Commits:
16882ea1 by Emmanuel Bourg at 2026-11-21T00:15:17+01:00
New upstream version 6.1.0
- - - - -
80d37fd7 by Emmanuel Bourg at 2026-11-21T00:15:17+01:00
New upstream version 6.1.2
- - - - -
9c6102ca by Emmanuel Bourg at 2026-11-21T01:21:38+01:00
New upstream version 6.2.0
- - - - -


25 changed files:

- README.md
- changelog.txt
- pom.xml
- + src/it/embed-pom-dependency/pom.xml
- + src/it/embed-pom-dependency/verify.groovy
- + src/it/module-info-no-alien-resources/pom.xml
- + src/it/module-info-no-alien-resources/src/main/java/module-info.java
- + src/it/module-info-no-alien-resources/src/main/java/org/apache/felix/bundleits/moduleinfo/Sample.java
- + src/it/module-info-no-alien-resources/verify.groovy
- + src/it/proxy-interface-import/bundle/pom.xml
- + src/it/proxy-interface-import/bundle/src/main/java/org/apache/felix/proxy/client/Client.java
- + src/it/proxy-interface-import/pom.xml
- + src/it/proxy-interface-import/provider/pom.xml
- + src/it/proxy-interface-import/provider/src/main/java/org/apache/felix/proxy/api/Greeting.java
- + src/it/proxy-interface-import/provider/src/main/java/org/apache/felix/proxy/model/Message.java
- + src/it/proxy-interface-import/verify.groovy
- + src/it/unversioned-export-package-still-imported/pom.xml
- + src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test1/Dummy.java
- + src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test2/Dummy2.java
- + src/it/unversioned-export-package-still-imported/verify.groovy
- src/it/with-multi-release-jar/verify.groovy
- src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
- src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
- src/main/java/org/apache/felix/bundleplugin/baseline/BaselineReport.java
- src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java


Changes:

=====================================
README.md
=====================================
@@ -2,6 +2,10 @@ Maven-bundle-plugin
 
 # Upgrade notice
 
+* 6.2.0 uses bnd 7.4.0, which keeps java 17 as minimal java version.
+  * see https://github.com/bndtools/bnd/wiki/Changes-in-7.4.0 for more information.
+* 6.1.0 uses bnd 7.3.0, which keeps java 17 as minimal java version.
+  * see https://github.com/bndtools/bnd/wiki/Changes-in-7.3.0 for more information.
 * 6.0.0 uses bnd 7.0.0, which has java 17 as minimal java version.
   * see https://github.com/bndtools/bnd/wiki/Changes-in-7.0.0 for more information. 
 * 5.1.9 uses bnd 6.3.1, which has java 8 as minimal java version. 


=====================================
changelog.txt
=====================================
@@ -1,3 +1,21 @@
+Changes from 6.1.2 to 6.2.0
+---------------------------
+* Bug
+    * [FELIX-6830] - maven-bundle-plugin includes alien resources (e.g. beans_*.xsd, validation-*.xsd) from classpath dependencies when a module-info is present
+
+* Improvement
+    * [FELIX-6858] - Upgrade bndlib to 7.4.0. See https://github.com/bndtools/bnd/wiki/Changes-in-7.4.0
+
+Changes from 6.1.0 to 6.1.2
+---------------------------
+* Bug
+    * [FELIX-6857] - maven-bundle-plugin: do not embed type=pom dependencies (bnd fails opening the .pom as a JAR)
+
+Changes from 6.0.0 to 6.1.0
+---------------------------
+* Improvement
+    * FELIX-6741 Upgrade dependencies for maven-bundle-plugin (bnd 7.3.0 among other updates). See https://github.com/bndtools/bnd/wiki/Changes-in-7.3.0
+
 Changes from 5.1.9 to 6.0.0
 ---------------------------
 * Improvement


=====================================
pom.xml
=====================================
@@ -28,7 +28,7 @@
  <modelVersion>4.0.0</modelVersion>
 
  <artifactId>maven-bundle-plugin</artifactId>
- <version>6.0.2</version>
+ <version>6.2.0</version>
  <packaging>maven-plugin</packaging>
 
  <name>Maven Bundle Plugin</name>
@@ -45,7 +45,7 @@
      <connection>scm:git:https://github.com/apache/felix-dev.git</connection>
      <developerConnection>scm:git:https://github.com/apache/felix-dev.git</developerConnection>
      <url>https://gitbox.apache.org/repos/asf?p=felix-dev.git</url>
-    <tag>maven-bundle-plugin-6.0.2</tag>
+    <tag>maven-bundle-plugin-6.2.0</tag>
   </scm>
 
  <!-- Support for publishing the mvn site. -->
@@ -59,7 +59,7 @@
  <properties>
    <felix.java.version>8</felix.java.version>
    <maven.site.path>bundle-plugin-archives/bundle-plugin-LATEST</maven.site.path>
-   <project.build.outputTimestamp>1770971150</project.build.outputTimestamp>
+   <project.build.outputTimestamp>1788354575</project.build.outputTimestamp>
  </properties>
 
  <build>
@@ -168,28 +168,33 @@
  <dependencies>
   <dependency>
     <groupId>org.osgi</groupId>
-    <artifactId>org.osgi.core</artifactId>
-    <version>6.0.0</version>
+    <artifactId>osgi.core</artifactId>
+    <version>8.0.0</version>
+  </dependency>
+  <dependency>
+    <groupId>org.apache.felix</groupId>
+    <artifactId>org.apache.felix.metatype</artifactId>
+    <version>1.2.4</version>
   </dependency>
   <dependency>
     <groupId>biz.aQute.bnd</groupId>
     <artifactId>biz.aQute.bndlib</artifactId>
-    <version>7.0.0</version>
+    <version>7.4.0</version>
   </dependency>
   <dependency>
     <groupId>org.slf4j</groupId>
     <artifactId>slf4j-api</artifactId>
-    <version>1.7.25</version>
+    <version>2.0.17</version>
   </dependency>
   <dependency>
     <groupId>org.apache.felix</groupId>
     <artifactId>org.apache.felix.bundlerepository</artifactId>
-    <version>1.6.6</version>
+    <version>2.0.10</version>
   </dependency>
   <dependency>
     <groupId>org.apache.felix</groupId>
     <artifactId>org.apache.felix.utils</artifactId>
-    <version>1.6.0</version>
+    <version>1.11.8</version>
   </dependency>
   <dependency>
     <groupId>org.apache.maven</groupId>
@@ -218,22 +223,27 @@
   <dependency>
     <groupId>org.apache.maven.reporting</groupId>
     <artifactId>maven-reporting-api</artifactId>
-    <version>3.0</version>
+    <version>4.0.0</version>
   </dependency>
   <dependency>
    <groupId>org.apache.maven</groupId>
    <artifactId>maven-archiver</artifactId>
-   <version>3.5.2</version>
+   <version>3.6.3</version>
   </dependency>
   <dependency>
    <groupId>org.apache.maven.shared</groupId>
    <artifactId>maven-dependency-tree</artifactId>
-   <version>3.0</version>
+   <version>3.3.0</version>
   </dependency>
   <dependency>
    <groupId>org.codehaus.plexus</groupId>
    <artifactId>plexus-utils</artifactId>
-   <version>3.3.0</version>
+   <version>4.0.3</version>
+  </dependency>
+  <dependency>
+   <groupId>org.codehaus.plexus</groupId>
+   <artifactId>plexus-xml</artifactId>
+   <version>3.0.0</version>
   </dependency>
   <dependency>
    <groupId>org.sonatype.plexus</groupId>
@@ -243,17 +253,17 @@
   <dependency>
    <groupId>org.apache.maven.doxia</groupId>
    <artifactId>doxia-sink-api</artifactId>
-   <version>1.0</version>
+   <version>2.1.0</version>
   </dependency>
   <dependency>
    <groupId>org.apache.maven.doxia</groupId>
    <artifactId>doxia-site-renderer</artifactId>
-   <version>1.0</version>
+   <version>2.1.0</version>
   </dependency>
   <dependency>
    <groupId>org.apache.maven.plugin-tools</groupId>
    <artifactId>maven-plugin-annotations</artifactId>
-   <version>3.4</version>
+   <version>3.15.1</version>
    <scope>provided</scope>
   </dependency>
   <dependency>
@@ -271,7 +281,7 @@
   <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>4.13.1</version>
+      <version>4.13.2</version>
       <scope>test</scope>
   </dependency>
  </dependencies>


=====================================
src/it/embed-pom-dependency/pom.xml
=====================================
@@ -0,0 +1,62 @@
+<?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.
+-->
+<!--
+  FELIX-6857: a pom-type dependency (BOM/aggregator) resolves to a .pom file and contains no
+  classes. It must not be embedded, otherwise the .pom ends up on the bundle classpath and bnd
+  (7.3.0+) fails trying to open it as a JAR. Here junit-bom is a type=pom dependency alongside a
+  regular jar dependency; only the jar must be embedded.
+-->
+<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.felix.bundleits</groupId>
+  <artifactId>embed-pom-dependency</artifactId>
+  <version>1-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+  <dependencies>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>2.7</version>
+    </dependency>
+    <dependency>
+      <groupId>org.junit</groupId>
+      <artifactId>junit-bom</artifactId>
+      <version>5.11.3</version>
+      <type>pom</type>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>@project.version@</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Embed-Dependency>*;scope=compile</Embed-Dependency>
+            <Import-Package>*;resolution:=optional</Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>


=====================================
src/it/embed-pom-dependency/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.
+ */
+
+// FELIX-6857: reaching this script means the build succeeded (before the fix, embedding the
+// junit-bom .pom made bnd fail the build). Assert the pom was excluded but the jar was embedded.
+
+import java.util.jar.Manifest
+
+File manifestFile = new File(basedir, "target/classes/META-INF/MANIFEST.MF")
+assert manifestFile.exists() : "MANIFEST.MF was not generated"
+
+Manifest manifest = manifestFile.withInputStream { new Manifest(it) }
+def attributes = manifest.getMainAttributes()
+
+String bundleClassPath = attributes.getValue("Bundle-ClassPath") ?: ""
+String embeddedArtifacts = attributes.getValue("Embedded-Artifacts") ?: ""
+
+// the pom dependency must never be embedded
+assert !bundleClassPath.contains("junit-bom") : "pom dependency leaked onto Bundle-ClassPath: " + bundleClassPath
+assert !bundleClassPath.contains(".pom") : "a .pom leaked onto Bundle-ClassPath: " + bundleClassPath
+assert !embeddedArtifacts.contains("junit-bom") : "pom dependency was embedded: " + embeddedArtifacts
+
+// the regular jar dependency must still be embedded
+assert bundleClassPath.contains("commons-io") : "expected commons-io jar to be embedded, Bundle-ClassPath: " + bundleClassPath
+
+return true


=====================================
src/it/module-info-no-alien-resources/pom.xml
=====================================
@@ -0,0 +1,61 @@
+<?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.
+-->
+<!--
+  FELIX-6830: when a project ships a module-info.java, its compiled module-info.class lands in the
+  default (root) package. The plugin used to add the default package "." to Private-Package, which
+  made bnd copy the default package of every classpath jar into the bundle - dragging in alien
+  root-level resources such as the beans_*.xsd files bundled at the root of jakarta.enterprise.cdi-api.
+  The module descriptor itself must still end up in the bundle.
+-->
+<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.felix.bundleits</groupId>
+  <artifactId>module-info-no-alien-resources</artifactId>
+  <version>1-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+  <properties>
+    <maven.compiler.release>17</maven.compiler.release>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+  <dependencies>
+    <!-- carries beans_1_0.xsd .. beans_4_0.xsd at the JAR root (the default package) -->
+    <dependency>
+      <groupId>jakarta.enterprise</groupId>
+      <artifactId>jakarta.enterprise.cdi-api</artifactId>
+      <version>4.0.1</version>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>@project.version@</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Import-Package>*;resolution:=optional</Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>


=====================================
src/it/module-info-no-alien-resources/src/main/java/module-info.java
=====================================
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+module org.apache.felix.bundleits.moduleinfo {
+    exports org.apache.felix.bundleits.moduleinfo;
+}


=====================================
src/it/module-info-no-alien-resources/src/main/java/org/apache/felix/bundleits/moduleinfo/Sample.java
=====================================
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+package org.apache.felix.bundleits.moduleinfo;
+
+public final class Sample {
+    private Sample() {
+    }
+}


=====================================
src/it/module-info-no-alien-resources/verify.groovy
=====================================
@@ -0,0 +1,36 @@
+/*
+ * 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.util.zip.ZipFile
+
+File bundle = new File( basedir, "target/module-info-no-alien-resources-1-SNAPSHOT.jar" )
+assert bundle.exists() : "bundle was not built: " + bundle
+
+List<String> names = new ZipFile( bundle ).withCloseable { zip ->
+    zip.entries().collect { it.name }
+}
+
+// the module descriptor must still be packaged
+assert names.contains( "module-info.class" ) : "module-info.class is missing from the bundle: " + names
+
+// the project's own class must be packaged
+assert names.contains( "org/apache/felix/bundleits/moduleinfo/Sample.class" ) : "own class missing from the bundle: " + names
+
+// alien root-level resources from classpath dependencies (e.g. beans_*.xsd from cdi-api) must NOT leak in
+List<String> alien = names.findAll { it.toLowerCase().endsWith( ".xsd" ) }
+assert alien.isEmpty() : "alien resources leaked into the bundle: " + alien


=====================================
src/it/proxy-interface-import/bundle/pom.xml
=====================================
@@ -0,0 +1,54 @@
+<?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>
+    <parent>
+        <groupId>org.apache.felix.bundleits</groupId>
+        <artifactId>proxy-interface-import</artifactId>
+        <version>1-SNAPSHOT</version>
+    </parent>
+    <artifactId>proxy-interface-import-bundle</artifactId>
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.felix.bundleits</groupId>
+            <artifactId>proxy-interface-import-provider</artifactId>
+            <version>1-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>${mbp.version}</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>org.apache.felix.proxy.client</Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>


=====================================
src/it/proxy-interface-import/bundle/src/main/java/org/apache/felix/proxy/client/Client.java
=====================================
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+package org.apache.felix.proxy.client;
+
+import java.lang.reflect.Proxy;
+
+import org.apache.felix.proxy.api.Greeting;
+
+/**
+ * Creates a dynamic proxy for {@link Greeting}. This class only references the Greeting interface
+ * (via the {@code Greeting.class} literal); it never references org.apache.felix.proxy.model
+ * directly. That package therefore appears in Import-Package only because bnd (7.2.0+) inspects
+ * the method signatures of interfaces passed to Proxy.newProxyInstance.
+ */
+public class Client {
+    public Greeting create() {
+        return (Greeting) Proxy.newProxyInstance(
+                Client.class.getClassLoader(),
+                new Class[] { Greeting.class },
+                (proxy, method, args) -> null);
+    }
+}


=====================================
src/it/proxy-interface-import/pom.xml
=====================================
@@ -0,0 +1,48 @@
+<?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.felix.bundleits</groupId>
+    <artifactId>proxy-interface-import</artifactId>
+    <version>1-SNAPSHOT</version>
+    <packaging>pom</packaging>
+
+    <!--
+      Verifies bnd 7.2.0 Proxy.newProxyInstance detection: packages referenced only through the
+      method signatures of an interface passed to Proxy.newProxyInstance must be added to
+      Import-Package, even though the bundle's own bytecode never references them directly.
+
+      The interface (and the type used in its method signature) live in a separate 'provider'
+      module, so the 'bundle' module's bytecode references only the interface class literal.
+      Without the proxy detection, the method-signature package would not be imported.
+    -->
+
+    <properties>
+        <mbp.version>@project.version@</mbp.version>
+        <maven.compiler.release>17</maven.compiler.release>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <modules>
+        <module>provider</module>
+        <module>bundle</module>
+    </modules>
+</project>


=====================================
src/it/proxy-interface-import/provider/pom.xml
=====================================
@@ -0,0 +1,31 @@
+<?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>
+    <parent>
+        <groupId>org.apache.felix.bundleits</groupId>
+        <artifactId>proxy-interface-import</artifactId>
+        <version>1-SNAPSHOT</version>
+    </parent>
+    <artifactId>proxy-interface-import-provider</artifactId>
+    <!-- A plain jar (not an OSGi bundle): the interface below is external to the bundle under test. -->
+    <packaging>jar</packaging>
+</project>


=====================================
src/it/proxy-interface-import/provider/src/main/java/org/apache/felix/proxy/api/Greeting.java
=====================================
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+package org.apache.felix.proxy.api;
+
+import org.apache.felix.proxy.model.Message;
+
+/**
+ * Proxied interface. Its single method references {@link Message}, which lives in a different
+ * package. The bundle under test only references this interface via a class literal, so the
+ * Message package can reach Import-Package solely through bnd's Proxy.newProxyInstance detection.
+ */
+public interface Greeting {
+    Message greet();
+}


=====================================
src/it/proxy-interface-import/provider/src/main/java/org/apache/felix/proxy/model/Message.java
=====================================
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+package org.apache.felix.proxy.model;
+
+/**
+ * Referenced only from {@link org.apache.felix.proxy.api.Greeting}'s method signature.
+ */
+public class Message {
+    public String text() {
+        return "hello";
+    }
+}


=====================================
src/it/proxy-interface-import/verify.groovy
=====================================
@@ -0,0 +1,35 @@
+/*
+ * 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.util.jar.Manifest
+
+// Parse with java.util.jar.Manifest so that 72-column line folding is handled for us.
+Manifest manifest = new File(basedir, "bundle/target/classes/META-INF/MANIFEST.MF").withInputStream { new Manifest(it) }
+String importPackage = manifest.mainAttributes.getValue("Import-Package")
+assert importPackage != null : "Bundle has no Import-Package header"
+
+// Sanity check: the interface's own package is imported (referenced via the Greeting.class literal).
+assert importPackage.contains("org.apache.felix.proxy.api") :
+        "Expected the proxied interface's package to be imported. Import-Package was: " + importPackage
+
+// The actual assertion: the package used only by Greeting's method signature is imported because
+// bnd (7.2.0+) inspects the methods of interfaces passed to Proxy.newProxyInstance.
+// See https://github.com/bndtools/bnd/wiki/Changes-in-7.2.0 (-noproxyinterfaces disables this).
+assert importPackage.contains("org.apache.felix.proxy.model") :
+        "Expected the proxy interface's method-signature package (org.apache.felix.proxy.model) " +
+        "to be imported via Proxy.newProxyInstance detection. Import-Package was: " + importPackage


=====================================
src/it/unversioned-export-package-still-imported/pom.xml
=====================================
@@ -0,0 +1,51 @@
+<?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.felix.bundleits</groupId>
+    <artifactId>unversioned-export-package-still-imported</artifactId>
+    <version>1-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>17</source>
+                    <target>17</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>@project.version@</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>org.apache.felix.test1,org.apache.felix.test2;version="1-SNAPSHOT"</Export-Package>
+                        <Import-Package>org.apache.felix.test1,org.apache.felix.test2</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>


=====================================
src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test1/Dummy.java
=====================================
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+package org.apache.felix.test1;
+public class Dummy {
+}
\ No newline at end of file


=====================================
src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test2/Dummy2.java
=====================================
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+package org.apache.felix.test2;
+public class Dummy2 {
+}
\ No newline at end of file


=====================================
src/it/unversioned-export-package-still-imported/verify.groovy
=====================================
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+String manifest = new File( basedir, "target/classes/META-INF/MANIFEST.MF" ).text
+assert !manifest.isEmpty()
+
+manifest.eachLine() { line ->
+    if (line.contains("Import-Package") && !line.contains("org.apache.felix.test1")) {
+        // See https://github.com/bndtools/bnd/pull/6270
+        // bnd 7.3.0 by default would not add this to the Import-Package, as the version range is not specified
+        // the maven-bundle-plugin doesn't have this issue, as a default version is added to the Export-Package statement
+        // automatically if missing
+        throw new Exception("Unversioned Export-Package statements should also be added to Import-Package statements, as maven-bundle-plugin adds a default version (1.0.0)");
+    }
+    if (line.contains("Import-Package") && !line.contains("org.apache.felix.test2;version=")) {
+        throw new Exception("Versioned Export-Package should be part of the Import-Package, as it contains an explicit version range");
+    }
+}
+
+


=====================================
src/it/with-multi-release-jar/verify.groovy
=====================================
@@ -20,7 +20,7 @@ String manifest = new File( basedir, "target/classes/META-INF/MANIFEST.MF" ).tex
 assert !manifest.isEmpty()
 
 manifest.eachLine() { line ->
-    if (line.contains("Tool") && !line.contains("7.0.0")) {
+    if (line.contains("Tool") && !line.contains("7.4.0")) {
         throw new Exception("Wrong bnd version used");
     }
     if (line.contains("Embedded-Artifacts") && !line.contains("jersey-server-3.1.7.jar")) {


=====================================
src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
=====================================
@@ -550,8 +550,7 @@ public class BundlePlugin extends AbstractMojo
         Properties properties = new Properties();
         properties.putAll( getDefaultProperties( currentProject ) );
         properties.putAll( transformDirectives( originalInstructions ) );
-
-        if ( new MavenArchiver().parseOutputTimestamp( outputTimestamp ) != null )
+        if (MavenArchiver.parseBuildOutputTimestamp(outputTimestamp).isPresent())
         {
           properties.put( Constants.REPRODUCIBLE, outputTimestamp );
         }
@@ -1937,6 +1936,13 @@ public class BundlePlugin extends AbstractMojo
             scanner.setBasedir( outputDirectory );
             scanner.setIncludes( new String[]
                 { "**/*.class" } );
+            // FELIX-6830: module-info.class lives in the default (root) package. If it were counted
+            // as a local package, the default package "." would be added to Private-Package and bnd
+            // would then copy the default package of every classpath jar into the bundle, dragging in
+            // alien root-level resources (e.g. the beans_*.xsd files at the root of jakarta.enterprise.cdi-api).
+            // The module descriptor is re-added as an explicit resource below.
+            scanner.setExcludes( new String[]
+                { "**/module-info.class" } );
 
             scanner.addDefaultExcludes();
             scanner.scan();
@@ -2014,6 +2020,28 @@ public class BundlePlugin extends AbstractMojo
             String newInternal = StringUtils.replace( internal, LOCAL_PACKAGES, Processor.printClauses( privatePkgs ) );
             properties.setProperty( Analyzer.PRIVATE_PACKAGE, newInternal );
         }
+
+        // FELIX-6830: the module descriptor was deliberately left out of the package scan above (it is not a
+        // real package). Add it back as an explicit resource so the bundle keeps its module-info.class without
+        // the default package - and its alien classpath resources - being copied in.
+        if ( outputDirectory != null )
+        {
+            File moduleInfo = new File( outputDirectory, "module-info.class" );
+            if ( moduleInfo.isFile() )
+            {
+                String resourcePath = moduleInfo.getAbsolutePath().replace( File.separatorChar, '/' );
+                String clause = "module-info.class=" + resourcePath;
+                String includeResource = properties.getProperty( Analyzer.INCLUDE_RESOURCE );
+                if ( includeResource == null || includeResource.isEmpty() )
+                {
+                    properties.setProperty( Analyzer.INCLUDE_RESOURCE, clause );
+                }
+                else if ( !includeResource.contains( "module-info.class" ) )
+                {
+                    properties.setProperty( Analyzer.INCLUDE_RESOURCE, includeResource + ',' + clause );
+                }
+            }
+        }
     }
 
 


=====================================
src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
=====================================
@@ -52,6 +52,8 @@ public final class DependencyEmbedder extends AbstractDependencyFilter
     private String m_embedStripGroup;
     private String m_embedStripVersion;
 
+    private final Log m_log;
+
     /**
      * Inlined paths.
      */
@@ -67,6 +69,7 @@ public final class DependencyEmbedder extends AbstractDependencyFilter
     {
         super( dependencyArtifacts );
 
+        m_log = log;
         m_inlinedPaths = new LinkedHashSet<>();
         m_embeddedArtifacts = new LinkedHashSet<>();
     }
@@ -119,18 +122,46 @@ public final class DependencyEmbedder extends AbstractDependencyFilter
     {
         if ( null == inline || "false".equalsIgnoreCase( inline ) )
         {
-            m_embeddedArtifacts.addAll( dependencies );
+            for ( Artifact dependency : dependencies )
+            {
+                if ( isPomArtifact( dependency ) )
+                {
+                    continue;
+                }
+                m_embeddedArtifacts.add( dependency );
+            }
         }
         else
         {
             for ( Artifact dependency : dependencies )
             {
+                if ( isPomArtifact( dependency ) )
+                {
+                    continue;
+                }
                 addInlinedPaths( dependency, inline, m_inlinedPaths );
             }
         }
     }
 
 
+    /**
+     * A {@code pom} dependency (a BOM/aggregator) resolves to a {@code .pom} file and contains no classes.
+     * Embedding it would place the {@code .pom} on the bundle classpath, which bnd then fails to open as a
+     * JAR. Such artifacts must never be embedded, so they are skipped here with a warning.
+     */
+    private boolean isPomArtifact( Artifact dependency )
+    {
+        if ( "pom".equals( dependency.getType() ) )
+        {
+            m_log.warn( "Not embedding pom dependency " + dependency.getId()
+                + "; pom artifacts contain no classes and cannot be placed on the bundle classpath" );
+            return true;
+        }
+        return false;
+    }
+
+
     private static void addInlinedPaths( Artifact dependency, String inline, Collection<String> inlinedPaths )
     {
         File path = dependency.getFile();


=====================================
src/main/java/org/apache/felix/bundleplugin/baseline/BaselineReport.java
=====================================
@@ -324,23 +324,6 @@ public final class BaselineReport
         return !skip && outputDirectory != null;
     }
 
-    public void generate( @SuppressWarnings( "deprecation" ) org.codehaus.doxia.sink.Sink sink, Locale locale )
-        throws MavenReportException
-    {
-        final Context ctx = new Context();
-        ctx.sink = sink;
-        ctx.locale = locale;
-
-        try
-        {
-            execute(ctx);
-        }
-        catch ( Exception e )
-        {
-            getLog().warn( "An error occurred while producing the report page, see nested exceptions", e );
-        }
-    }
-
     public String getCategoryName()
     {
         return MavenReport.CATEGORY_PROJECT_REPORTS;
@@ -361,6 +344,22 @@ public final class BaselineReport
         return ResourceBundle.getBundle( "baseline-report", locale, getClass().getClassLoader() );
     }
 
+    @Override
+    public void generate(Sink sink, Locale locale) throws MavenReportException {
+        final Context ctx = new Context();
+        ctx.sink = sink;
+        ctx.locale = locale;
+
+        try
+        {
+            execute(ctx);
+        }
+        catch ( Exception e )
+        {
+            getLog().warn( "An error occurred while producing the report page, see nested exceptions", e );
+        }
+    }
+
     public String getOutputName()
     {
         return "baseline-report";


=====================================
src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
=====================================
@@ -37,6 +37,7 @@ import java.util.TreeMap;
 import java.util.jar.Manifest;
 
 import org.apache.felix.bundleplugin.BundlePlugin.ClassPathItem;
+import org.apache.maven.artifact.Artifact;
 import org.apache.maven.model.Organization;
 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
 import org.apache.maven.project.MavenProject;
@@ -252,6 +253,35 @@ public class BundlePluginTest extends AbstractBundlePluginTest
     }
 
 
+    public void testEmbedDependencyExcludesPomArtifacts() throws Exception
+    {
+        // FELIX-6857: a pom-type dependency (BOM/aggregator) resolves to a .pom file with no classes;
+        // it must never be embedded, otherwise the .pom ends up on the bundle classpath and bnd fails
+        // trying to open it as a JAR.
+        ArtifactStubFactory artifactFactory = new ArtifactStubFactory( plugin.getOutputDirectory(), true );
+
+        Set artifacts = new LinkedHashSet();
+        artifacts.add( artifactFactory.createArtifact( "g", "jardep", "1.0", Artifact.SCOPE_COMPILE, "jar", null ) );
+        artifacts.add( artifactFactory.createArtifact( "g", "pomdep", "1.0", Artifact.SCOPE_COMPILE, "pom", null ) );
+
+        MavenProject project = getMavenProjectStub();
+        project.setDependencyArtifacts( artifacts );
+
+        Map instructions = new HashMap();
+        instructions.put( DependencyEmbedder.EMBED_DEPENDENCY, "*;scope=compile" );
+
+        Builder builder = plugin.buildOSGiBundle( project, instructions, plugin.getClasspath( project ) );
+        Manifest manifest = builder.getJar().getManifest();
+
+        // only the jar is embedded; the pom is excluded from both Bundle-ClassPath and Embedded-Artifacts
+        String bcp = manifest.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH );
+        assertEquals( ".,jardep-1.0.jar", bcp );
+
+        String eas = manifest.getMainAttributes().getValue( "Embedded-Artifacts" );
+        assertEquals( "jardep-1.0.jar;g=\"g\";a=\"jardep\";v=\"1.0\"", eas );
+    }
+
+
     public void testEmbedDependencyNegativeClauses() throws Exception
     {
         ArtifactStubFactory artifactFactory = new ArtifactStubFactory( plugin.getOutputDirectory(), true );



View it on GitLab: https://salsa.debian.org/java-team/maven-bundle-plugin/-/compare/d881f18ad26b35efc0df15a2eecba27bc2870f14...9c6102caba6ac29ed4bc5a43ad9d4cfdee5d123f

-- 
View it on GitLab: https://salsa.debian.org/java-team/maven-bundle-plugin/-/compare/d881f18ad26b35efc0df15a2eecba27bc2870f14...9c6102caba6ac29ed4bc5a43ad9d4cfdee5d123f
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20261122/4d9aeffb/attachment.htm>


More information about the pkg-java-commits mailing list