I have an eclipse plugin with this manifest:
...
Bundle-ClassPath: .,
lib/drools-api.jar,
lib/drools-core.jar,
...
Now we don't want to put drools-api.jar
and drools-core.jar
in source control, so we use a plugin to fetch them from the maven repository:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-bundle-classpath-libs</id>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>lib</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<stripVersion>true</stripVersion>
<artifactItems>
<artifactItem>
<groupId>org.drools</groupId>
<artifactId>drools-api</artifactId>
</artifactItem>
<artifactItem>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
</artifactItem>
...
However, the first time we build this module, it fails, because this happens:
[WARNING] Missing classpath entry lib/drools-api.jar ...
[WARNING] Missing classpath entry lib/drools-core.jar ...
...
[INFO] --- maven-dependency-plugin:2.1:copy (copy-bundle-classpath-libs) ... ---
...
[INFO] Copying drools-api-5.2.0-SNAPSHOT.jar to .../lib/drools-api.jar
[INFO] Copying drools-core-5.2.0-SNAPSHOT.jar to .../lib/drools-core.jar
...
[INFO] --- maven-osgi-compiler-plugin:0.10.0:compile (default-compile) ... ---
...
[INFO] Compiling 458 source files to ...
// ERROR because drools-api is not in the compilation classpath
If we just build it again, it succeeds, because the jars are already in the lib
directory before the builds starts: there are no warnings and the jars are in the compilation classpath.
How can we fix this so we don't need to commit the jars in source control and still use Bundle-ClassPath
?
Note: the current implementation of the plugin requires us to use Bundle-ClassPath
: using Require-Bundle
instead is not an option.