Skip to content

Commit

Permalink
Add testcase for conditional packages with bnd-process
Browse files Browse the repository at this point in the history
This adds a testacse where conditional package is used with  bnd-process

Signed-off-by: Christoph Läubrich <[email protected]>
  • Loading branch information
laeubi committed Nov 10, 2024
1 parent e3c95f8 commit 3962626
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This is an example bundle that used bnd-process together with conditional package.

Points of interest:

* the conditional packages apaer in the maven output folder
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
invoker.goals=--no-transfer-progress package

# Run mvn with --debug for debug logging
#invoker.debug=true

# Run mvn in debugging mode and wait for a debugger to attach
#invoker.environmentVariables.MAVEN_DEBUG_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-conditionalpackage: com.google.common.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<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>biz.aQute.bnd-test</groupId>
<artifactId>test</artifactId>
<version>0.0.2</version>
<relativePath>../process-parent</relativePath>
</parent>
<artifactId>test-bnd-process-conditional</artifactId>
<version>0.0.1-SNAPSHOT</version>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.opensource.org/licenses/apache2.0.php</url>
<distribution>repo</distribution>
</license>
</licenses>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.0.1-jre</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import java.util.jar.JarFile;
import java.util.jar.JarEntry

JarFile jar = new JarFile( new File(basedir, 'target/test-bnd-process-conditional-0.0.1-SNAPSHOT.jar'))
JarEntry entry = jar.getEntry('com/google/common/cache/Cache.class')
assert entry != null
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.example.impl;

import java.util.concurrent.TimeUnit;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;

public class Config {
public static void main(String[] args) {
Cache<String, String> myCache = CacheBuilder.newBuilder().maximumSize(100)
.expireAfterWrite(30, TimeUnit.SECONDS).build();
}
}

0 comments on commit 3962626

Please sign in to comment.