This is an automated email from the ASF dual-hosted git repository. stbischof pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/felix-dev.git
commit 83d654eb2b4ece4e4494cd3b65845f82c962cf77 Author: Paul Rütter <[email protected]> AuthorDate: Tue Jun 4 11:22:10 2024 +0200 Add integration test that includes multi-release jar and validates a proper manifest is created with bnd 7.0.0 --- .../src/it/with-multi-release-jar/pom.xml | 72 ++++++++++++++++++++++ .../src/main/java/org/apache/felix/test/Dummy.java | 21 +++++++ .../src/it/with-multi-release-jar/verify.groovy | 31 ++++++++++ 3 files changed, 124 insertions(+) diff --git a/tools/maven-bundle-plugin/src/it/with-multi-release-jar/pom.xml b/tools/maven-bundle-plugin/src/it/with-multi-release-jar/pom.xml new file mode 100644 index 0000000000..cbd30a0e36 --- /dev/null +++ b/tools/maven-bundle-plugin/src/it/with-multi-release-jar/pom.xml @@ -0,0 +1,72 @@ +<?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>with-multi-release-jar</artifactId> + <version>1-SNAPSHOT</version> + <packaging>bundle</packaging> + <dependencyManagement> + <dependencies> + <!-- https://mvnrepository.com/artifact/org.glassfish.jersey/jersey-bom --> + <dependency> + <groupId>org.glassfish.jersey</groupId> + <artifactId>jersey-bom</artifactId> + <version>3.1.7</version> + <type>pom</type> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> + <!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-server --> + <!-- this is a multi-release jar --> + <dependency> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-server</artifactId> + <version>3.1.7</version> + <scope>compile</scope> + </dependency> + </dependencies> + <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> + <Embed-Dependency>*;scope=compile</Embed-Dependency> + <Embed-Transitive>true</Embed-Transitive> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/tools/maven-bundle-plugin/src/it/with-multi-release-jar/src/main/java/org/apache/felix/test/Dummy.java b/tools/maven-bundle-plugin/src/it/with-multi-release-jar/src/main/java/org/apache/felix/test/Dummy.java new file mode 100644 index 0000000000..e008adaa95 --- /dev/null +++ b/tools/maven-bundle-plugin/src/it/with-multi-release-jar/src/main/java/org/apache/felix/test/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.test; +public class Dummy { +} \ No newline at end of file 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 new file mode 100644 index 0000000000..54aa86f9a3 --- /dev/null +++ b/tools/maven-bundle-plugin/src/it/with-multi-release-jar/verify.groovy @@ -0,0 +1,31 @@ +/* + * 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("Tool") && !line.contains("7.0.0")) { + throw new Exception("Wrong bnd version used"); + } + if (line.contains("Embedded-Artifacts") && !line.contains("jersey-server-3.1.7.jar")) { + throw new Exception("The multi release jar is not properly embedded"); + } +} + +
