From 8cc01b4d0f882db8cd91aaa813f0601a59de707c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20R=C3=BCtter?= Date: Sun, 1 Dec 2024 13:37:31 +0100 Subject: [PATCH 1/4] FELIX-6741 Upgrade dependencies for maven-bundle-plugin - Upgrade all dependencies, including bnd 7.1.0 --- tools/maven-bundle-plugin/changelog.txt | 5 +++ tools/maven-bundle-plugin/pom.xml | 41 +++++++++++-------- .../felix/bundleplugin/BundlePlugin.java | 3 +- .../bundleplugin/baseline/BaselineReport.java | 33 ++++++++------- 4 files changed, 45 insertions(+), 37 deletions(-) diff --git a/tools/maven-bundle-plugin/changelog.txt b/tools/maven-bundle-plugin/changelog.txt index 5a60fdadaf..f0fb150f5c 100644 --- a/tools/maven-bundle-plugin/changelog.txt +++ b/tools/maven-bundle-plugin/changelog.txt @@ -1,3 +1,8 @@ +Changes from 6.0.0 to 6.1.0 +--------------------------- +* Improvement + * FELIX-6741 Upgrade dependencies for maven-bundle-plugin (bnd 7.1.0 among other updates). See https://github.com/bndtools/bnd/wiki/Changes-in-7.1.0 + Changes from 5.1.9 to 6.0.0 --------------------------- * Improvement diff --git a/tools/maven-bundle-plugin/pom.xml b/tools/maven-bundle-plugin/pom.xml index 19848a9658..93d43c7e52 100644 --- a/tools/maven-bundle-plugin/pom.xml +++ b/tools/maven-bundle-plugin/pom.xml @@ -168,72 +168,77 @@ org.osgi - org.osgi.core - 6.0.0 + osgi.core + 8.0.0 + + + org.apache.felix + org.apache.felix.metatype + 1.2.4 biz.aQute.bnd biz.aQute.bndlib - 7.0.0 + 7.1.0 org.slf4j slf4j-api - 1.7.25 + 2.0.16 org.apache.felix org.apache.felix.bundlerepository - 1.6.6 + 2.0.10 org.apache.felix org.apache.felix.utils - 1.6.0 + 1.11.8 org.apache.maven maven-core - 3.8.1 + 3.9.9 provided org.apache.maven maven-model - 3.3.9 + 3.9.9 provided org.apache.maven maven-artifact - 3.3.9 + 3.9.9 provided org.apache.maven maven-compat - 3.8.1 + 3.9.9 provided org.apache.maven.reporting maven-reporting-api - 3.0 + 4.0.0 org.apache.maven maven-archiver - 3.5.2 + 3.6.3 org.apache.maven.shared maven-dependency-tree - 3.0 + 3.3.0 org.codehaus.plexus plexus-utils - 3.3.0 + 4.0.2 org.sonatype.plexus @@ -243,17 +248,17 @@ org.apache.maven.doxia doxia-sink-api - 1.0 + 2.0.0 org.apache.maven.doxia doxia-site-renderer - 1.0 + 2.0.0 org.apache.maven.plugin-tools maven-plugin-annotations - 3.4 + 3.15.1 provided @@ -271,7 +276,7 @@ junit junit - 4.13.1 + 4.13.2 test diff --git a/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java b/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java index 7c54ba1b75..db38474ae1 100644 --- a/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java +++ b/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java @@ -550,8 +550,7 @@ protected Builder getOSGiBuilder( MavenProject currentProject, Map Date: Sun, 5 Jan 2025 07:40:47 +0100 Subject: [PATCH 2/4] FELIX-6741-Upgrade-dependencies-for-maven-bundle-plugin - Reset maven version to 3.3.9, as specified in bnd 7.1.0 changelog - Fix tests; add build timestamp greater than 1980 (required in new maven-archiver) - Fix tests; change bnd version --- tools/maven-bundle-plugin/pom.xml | 4 ++-- .../maven-bundle-plugin/src/it/reproducible-manifest/pom.xml | 2 +- tools/maven-bundle-plugin/src/it/reproducible/pom.xml | 2 +- .../src/it/with-multi-release-jar/verify.groovy | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/maven-bundle-plugin/pom.xml b/tools/maven-bundle-plugin/pom.xml index 93d43c7e52..c3fd3b6349 100644 --- a/tools/maven-bundle-plugin/pom.xml +++ b/tools/maven-bundle-plugin/pom.xml @@ -199,13 +199,13 @@ org.apache.maven maven-core - 3.9.9 + 3.3.9 provided org.apache.maven maven-model - 3.9.9 + 3.3.9 provided diff --git a/tools/maven-bundle-plugin/src/it/reproducible-manifest/pom.xml b/tools/maven-bundle-plugin/src/it/reproducible-manifest/pom.xml index 38f3ae2444..40368a44cb 100644 --- a/tools/maven-bundle-plugin/src/it/reproducible-manifest/pom.xml +++ b/tools/maven-bundle-plugin/src/it/reproducible-manifest/pom.xml @@ -26,7 +26,7 @@ under the License. - 1 + 2023-01-01T00:00:00Z diff --git a/tools/maven-bundle-plugin/src/it/reproducible/pom.xml b/tools/maven-bundle-plugin/src/it/reproducible/pom.xml index d0ae17c502..3f17290c44 100644 --- a/tools/maven-bundle-plugin/src/it/reproducible/pom.xml +++ b/tools/maven-bundle-plugin/src/it/reproducible/pom.xml @@ -25,7 +25,7 @@ under the License. 1-SNAPSHOT bundle - 1 + 2023-01-01T00:00:00Z diff --git a/tools/maven-bundle-plugin/src/it/with-multi-release-jar/verify.groovy b/tools/maven-bundle-plugin/src/it/with-multi-release-jar/verify.groovy index 54aa86f9a3..e01b3f62e0 100644 --- a/tools/maven-bundle-plugin/src/it/with-multi-release-jar/verify.groovy +++ b/tools/maven-bundle-plugin/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.1.0")) { throw new Exception("Wrong bnd version used"); } if (line.contains("Embedded-Artifacts") && !line.contains("jersey-server-3.1.7.jar")) { From 4556b12f181813ca7ce549520f77d907d2fa8b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20R=C3=BCtter?= Date: Sun, 5 Jan 2025 07:48:00 +0100 Subject: [PATCH 3/4] FELIX-6741-Upgrade-dependencies-for-maven-bundle-plugin - Don't lower maven version used earlier --- tools/maven-bundle-plugin/pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/maven-bundle-plugin/pom.xml b/tools/maven-bundle-plugin/pom.xml index c3fd3b6349..3cbe341d59 100644 --- a/tools/maven-bundle-plugin/pom.xml +++ b/tools/maven-bundle-plugin/pom.xml @@ -199,7 +199,7 @@ org.apache.maven maven-core - 3.3.9 + 3.8.1 provided @@ -211,13 +211,13 @@ org.apache.maven maven-artifact - 3.9.9 + 3.3.9 provided org.apache.maven maven-compat - 3.9.9 + 3.8.1 provided From 56287137b695848c2d525b814041c33e8d440a8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20R=C3=BCtter?= Date: Sun, 5 Jan 2025 09:08:58 +0100 Subject: [PATCH 4/4] FELIX-6741-Upgrade-dependencies-for-maven-bundle-plugin - Add integration test for Export-Package / Import-Package, based on https://github.com/bndtools/bnd/pull/6270 - This is backwards compatible, as maven-bundle-plugin automatically adds a version for all Export-Package statements if not specified (1.0.0) These instructions: ``` org.apache.felix.test1,org.apache.felix.test2;version="1-SNAPSHOT" org.apache.felix.test1,org.apache.felix.test2 ``` Lead to these manifest entries: ``` Export-Package: org.apache.felix.test1;version="1.0.0",org.apache.felix. test2;version="1.0.0.SNAPSHOT" Import-Package: org.apache.felix.test1,org.apache.felix.test2;version="[ 1.0,2)" ``` --- .../pom.xml | 51 +++++++++++++++++++ .../java/org/apache/felix/test1/Dummy.java | 21 ++++++++ .../java/org/apache/felix/test2/Dummy2.java | 21 ++++++++ .../verify.groovy | 35 +++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/pom.xml create mode 100644 tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test1/Dummy.java create mode 100644 tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test2/Dummy2.java create mode 100644 tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/verify.groovy diff --git a/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/pom.xml b/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/pom.xml new file mode 100644 index 0000000000..5b4209ce89 --- /dev/null +++ b/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/pom.xml @@ -0,0 +1,51 @@ + + + + 4.0.0 + org.apache.felix.bundleits + unversioned-export-package-still-imported + 1-SNAPSHOT + bundle + + + + org.apache.maven.plugins + maven-compiler-plugin + + 17 + 17 + + + + org.apache.felix + maven-bundle-plugin + @project.version@ + true + + + org.apache.felix.test1,org.apache.felix.test2;version="1-SNAPSHOT" + org.apache.felix.test1,org.apache.felix.test2 + + + + + + diff --git a/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test1/Dummy.java b/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test1/Dummy.java new file mode 100644 index 0000000000..30f4f42293 --- /dev/null +++ b/tools/maven-bundle-plugin/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 diff --git a/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test2/Dummy2.java b/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/src/main/java/org/apache/felix/test2/Dummy2.java new file mode 100644 index 0000000000..90e34e9370 --- /dev/null +++ b/tools/maven-bundle-plugin/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 diff --git a/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/verify.groovy b/tools/maven-bundle-plugin/src/it/unversioned-export-package-still-imported/verify.groovy new file mode 100644 index 0000000000..ee2ae918d0 --- /dev/null +++ b/tools/maven-bundle-plugin/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.1.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"); + } +} + +