Merge pull request #6363 from laeubi/process_with_conditional_package · bndtools/bnd@2fc3187 (original) (raw)
File tree
- maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional
- src/main/java/org/example/impl
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| 1 | +This is an example bundle that used bnd-process together with conditional package. | |
| 2 | + | |
| 3 | +Points of interest: | |
| 4 | + | |
| 5 | +* the conditional packages apaer in the maven output folder |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| 1 | +invoker.goals=--no-transfer-progress package | |
| 2 | + | |
| 3 | +# Run mvn with --debug for debug logging | |
| 4 | +#invoker.debug=true | |
| 5 | + | |
| 6 | +# Run mvn in debugging mode and wait for a debugger to attach | |
| 7 | +#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 @@ | ||
| 1 | +-conditionalpackage: com.google.common.cache |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| 1 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | |
| 2 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 " title="undefined" rel="noopener noreferrer">http://maven.apache.org/xsd/maven-4.0.0.xsd"\> | |
| 4 | + <modelVersion>4.0.0</modelVersion> | |
| 5 | + <parent> | |
| 6 | + <groupId>biz.aQute.bnd-test</groupId> | |
| 7 | + <artifactId>test</artifactId> | |
| 8 | + <version>0.0.2</version> | |
| 9 | + <relativePath>../process-parent</relativePath> | |
| 10 | + </parent> | |
| 11 | + <artifactId>test-bnd-process-conditional</artifactId> | |
| 12 | + <version>0.0.1-SNAPSHOT</version> | |
| 13 | + <licenses> | |
| 14 | + <license> | |
| 15 | + <name>Apache License, Version 2.0</name> | |
| 16 | + <url>http://www.opensource.org/licenses/apache2.0.php</url> | |
| 17 | + <distribution>repo</distribution> | |
| 18 | + </license> | |
| 19 | + </licenses> | |
| 20 | + <dependencies> | |
| 21 | + <dependency> | |
| 22 | + <groupId>com.google.guava</groupId> | |
| 23 | + <artifactId>guava</artifactId> | |
| 24 | + <version>32.0.1-jre</version> | |
| 25 | + </dependency> | |
| 26 | + </dependencies> | |
| 27 | + | |
| 28 | + <build> | |
| 29 | + <plugins> | |
| 30 | + <plugin> | |
| 31 | + <groupId>biz.aQute.bnd</groupId> | |
| 32 | + <artifactId>bnd-maven-plugin</artifactId> | |
| 33 | + </plugin> | |
| 34 | + </plugins> | |
| 35 | + </build> | |
| 36 | + | |
| 37 | +</project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| 1 | +import java.util.jar.JarFile; | |
| 2 | +import java.util.jar.JarEntry | |
| 3 | + | |
| 4 | +JarFile jar = new JarFile( new File(basedir, 'target/test-bnd-process-conditional-0.0.1-SNAPSHOT.jar')) | |
| 5 | +JarEntry entry = jar.getEntry('com/google/common/cache/Cache.class') | |
| 6 | +assert entry != null |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| 1 | +package org.example.impl; | |
| 2 | + | |
| 3 | +import java.util.concurrent.TimeUnit; | |
| 4 | + | |
| 5 | +import com.google.common.cache.Cache; | |
| 6 | +import com.google.common.cache.CacheBuilder; | |
| 7 | + | |
| 8 | +public class Config { | |
| 9 | +public static void main(String[] args) { | |
| 10 | +Cache<String, String> myCache = CacheBuilder.newBuilder().maximumSize(100) | |
| 11 | + .expireAfterWrite(30, TimeUnit.SECONDS).build(); | |
| 12 | + } | |
| 13 | +} |