我是 OSGI 的新手。我一直无法在生成的 jar 文件中获取 OSGI-INF 文件夹。我需要有如下文件夹结构
- 元信息
- OSGI-INF
- com.mine.cq
我正在使用 Eclipse 和 m2e 插件。当我运行我的项目时,我得到了 BUILD SUCCESS。我在生成的 jar 文件中得到了以下文件夹结构。
- 元信息
- com.mine.cq
这是我的 POM.xml
<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>
<groupId>com.mine.cq</groupId>
<artifactId>mineCore</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mineCore</name>
<url>http://maven.apache.org</url>
<properties>
<file.encoding>utf-8</file.encoding>
</properties>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0-alpha-3</version>
<executions>
<execution>
<id>enforce-java</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<message>Project must be built with Maven 2.0.7 or higher</message>
<version>2.0.7</version>
</requireMavenVersion>
<requireJavaVersion>
<message>Project must be compiled with Java 5 or higher</message>
<version>1.5.0</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>
com.mine.cq.mineCore.*
</Export-Package>
<Import-Package>
*;resolution:=optional,
javax.servlet;version=2.4,
javax.servlet.http;version=2.4
</Import-Package>
<Embed-Dependency>
</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Include-Resource>{maven-resources}</Include-Resource>
<Sling-Bundle-Resources>/var/classes</Sling-Bundle-Resources>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.0</version>
<configuration>
<goals>install</goals>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
为什么 OSGI-INF 文件夹不在 .jar 文件中?我需要在 OSGO-INF 文件夹中设置一些信息,因为我必须将我的组件注册为 OSGI 服务。请指导我完成它。