我有一个带有此清单的 Eclipse 插件:
...
Bundle-ClassPath: .,
lib/drools-api.jar,
lib/drools-core.jar,
...
现在我们不想把drools-api.jar
和drools-core.jar
放在源代码控制中,所以我们使用插件从 maven 存储库中获取它们:
<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>
...
但是,我们第一次构建这个模块时,它失败了,因为发生了这种情况:
[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
如果我们再次构建它,它会成功,因为在lib
构建开始之前,jar 已经在目录中:没有警告,并且 jar 在编译类路径中。
我们如何解决这个问题,这样我们就不需要在源代码控制中提交 jars 并仍然使用Bundle-ClassPath
?
注意:插件的当前实现要求我们使用Bundle-ClassPath
: usingRequire-Bundle
不是一个选项。