Skip to content

Commit

Permalink
[#321] add the bnd-resolver-maven plugin that verifies that the bundl…
Browse files Browse the repository at this point in the history
…es will in fact resolve in an OSGi environment (with respect to available dependencies)

fixes #321

Signed-off-by: Raymond Augé <raymond.auge@liferay.com>
  • Loading branch information
rotty3000 committed Jan 30, 2021
1 parent c78ba44 commit eae65f5
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 1 deletion.
9 changes: 9 additions & 0 deletions json-unit-assertj/pom.xml
Expand Up @@ -127,6 +127,15 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-resolver-maven-plugin</artifactId>
<configuration>
<bndruns>
<bndrun>resolve.bndrun</bndrun>
</bndruns>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 2 additions & 0 deletions json-unit-assertj/resolve.bndrun
@@ -0,0 +1,2 @@
-runfw: org.eclipse.osgi
-runrequires: bnd.identity;id='${project.groupId}.${project.artifactId}'
10 changes: 9 additions & 1 deletion json-unit-core/pom.xml
Expand Up @@ -53,7 +53,6 @@
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-json_1.1_spec</artifactId>
<version>${geronimo.jsonp.version}</version>
<optional>true</optional>
</dependency>
<dependency>
Expand Down Expand Up @@ -120,6 +119,15 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-resolver-maven-plugin</artifactId>
<configuration>
<bndruns>
<bndrun>resolve.bndrun</bndrun>
</bndruns>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 2 additions & 0 deletions json-unit-core/resolve.bndrun
@@ -0,0 +1,2 @@
-runfw: org.eclipse.osgi
-runrequires: bnd.identity;id='${project.groupId}.${project.artifactId}'
9 changes: 9 additions & 0 deletions json-unit-fluent/pom.xml
Expand Up @@ -40,6 +40,15 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-resolver-maven-plugin</artifactId>
<configuration>
<bndruns>
<bndrun>resolve.bndrun</bndrun>
</bndruns>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 2 additions & 0 deletions json-unit-fluent/resolve.bndrun
@@ -0,0 +1,2 @@
-runfw: org.eclipse.osgi
-runrequires: bnd.identity;id='${project.groupId}.${project.artifactId}'
15 changes: 15 additions & 0 deletions json-unit-json-path/pom.xml
Expand Up @@ -27,6 +27,12 @@
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>${json-path.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
Expand Down Expand Up @@ -55,6 +61,15 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-resolver-maven-plugin</artifactId>
<configuration>
<bndruns>
<bndrun>resolve.bndrun</bndrun>
</bndruns>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 2 additions & 0 deletions json-unit-json-path/resolve.bndrun
@@ -0,0 +1,2 @@
-runfw: org.eclipse.osgi
-runrequires: bnd.identity;id='${project.groupId}.${project.artifactId}'
9 changes: 9 additions & 0 deletions json-unit/pom.xml
Expand Up @@ -38,6 +38,15 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-resolver-maven-plugin</artifactId>
<configuration>
<bndruns>
<bndrun>resolve.bndrun</bndrun>
</bndruns>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 2 additions & 0 deletions json-unit/resolve.bndrun
@@ -0,0 +1,2 @@
-runfw: org.eclipse.osgi
-runrequires: bnd.identity;id='${project.groupId}.${project.artifactId}'
55 changes: 55 additions & 0 deletions pom.xml
Expand Up @@ -19,6 +19,7 @@
<json-path.version>2.4.0</json-path.version>
<opentest4j.version>1.2.0</opentest4j.version>
<kotlin.version>1.4.21</kotlin.version>
<bnd.version>5.2.0</bnd.version>
<symbolic.name>${project.groupId}.${project.artifactId}</symbolic.name>
<osgi.importPackage>!kotlin.*,*</osgi.importPackage>
<osgi.exportPackage />
Expand Down Expand Up @@ -63,6 +64,29 @@

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.aries.spifly</groupId>
<artifactId>org.apache.aries.spifly.dynamic.framework.extension</artifactId>
<version>1.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.johnzon</groupId>
<artifactId>johnzon-core</artifactId>
<version>1.2.10</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-json_1.1_spec</artifactId>
<version>${geronimo.jsonp.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.osgi</artifactId>
<version>3.16.100</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
Expand Down Expand Up @@ -162,6 +186,37 @@
<target>${target.java.version}</target>
</configuration>
</plugin>

<!-- Asserts that the resulting bundle resolves adequately in OSGi in terms
of it's dependencies. If this check fails it is most likely a problem
with package export or import specification. -->
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-resolver-maven-plugin</artifactId>
<version>${bnd.version}</version>
<configuration>
<failOnChanges>false</failOnChanges>
<includeDependencyManagement>true</includeDependencyManagement>
<reportOptional>false</reportOptional>
<writeOnChanges>false</writeOnChanges>
<bundles>
<bundle>target/${project.artifactId}-${project.version}.jar</bundle>
</bundles>
<scopes>
<scope>compile</scope>
<scope>runtime</scope>
<scope>test</scope>
</scopes>
</configuration>
<executions>
<execution>
<phase>pre-integration-test</phase>
<goals>
<goal>resolve</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand Down

0 comments on commit eae65f5

Please sign in to comment.