我正在运行pax提供来创建helloworld OSGI应用程序。在pom.xml中,我添加了以下配置
<plugin>
<groupId>org.ops4j</groupId>
<artifactId>maven-pax-plugin</artifactId>
<version>1.5</version>
<configuration>
<!--
| some example Pax-Runner settings
-->
<provision>
<param>--platform=equinox</param>
<param>--profiles=minimal</param>
<param>--version=3.3.2</param>
<param>--log=DEBUG</param>
<param>--bcp/p=file:///C:/mavenrepo/org/eclipse/equinox/simpleconfigurator/1.0.400/simpleconfigurator-1.0.400.jar</param>
<param>--bcp/p=file:///.</param>
</provision>
</configuration>
<executions>
<!--
| uncomment to auto-generate IDE files
-->
<execution>
<id>ide-support</id>
<goals>
<goal>eclipse</goal>
</goals>
</execution>
</executions>
</plugin>
EclipseStarter文件是simpleconfigurationr jar文件的一部分,该文件是类路径。以下是启动前的日志:
-> Using class org.ops4j.pax.runner.platform.DefaultJavaRunner [org.eclipse.core.runtime.adaptor.EclipseStarter]
-> VM options: [[-Dosgi.install.area=equinox]]
-> Classpath: [[bundles/org.eclipse.equinox.simpleconfigurator_1.0.400.v20130327-2119.jar, bundles/-855037795_0.0.0.jar, bundles/org.apache.felix.gogo.shell_0.10.0.jar]]
-> Platform options: [[-console, -configuration, equinox]]
-> Java home: [C:Javajdk1.6.0_22]
-> Working dir: [runner]
-> Environment options: [null]
-> Start command line [[C:Javajdk1.6.0_22/bin/java, -Dosgi.install.area=equinox, -cp, bundles/org.eclipse.equinox.simpleconfigurator_1.0.400.v20130327-2119.jar;bundles/-855037795_0.0.0.jar;bundles/org.apache.felix.gogo.shell_0.10.0.jar, org.eclipse.core.runtime.adaptor.EclipseStarter, -console, -configuration, equinox]]
-> Starting platform process.
-> Wrapping stream I/O.
-> Added shutdown hook.
-> Runner has successfully finished his job!
-> Waiting for framework exit.
java.lang.NoClassDefFoundError: org/eclipse/core/runtime/adaptor/EclipseStarter
我无法向它提供jar文件,因此没有得到osgi>提示。
通过放置条目解决了问题
link\:classpath \:runner links/org.eclipse.osgi-3.2.link=org.eclipse.osgi-3.2.R33x_v20080105.jarlink\:classpath \:runner links/org.apache.filix.gogo.shell-0.10.0=org.apache.filex.gogo-shell_0.10.0.jar
runner/bundles/downloaded_bundles.properties文件中。此外,org.eclipse.osgi_3.2.R33x_v20080105.jar被放置在bundle目录