2012-12-28 24 views
0

我正在開發與處女座的OSGi應用程序,並使用maven bundlor構建捆綁包。我想使用由處女座使用的我的MANIFEST.MF,其中包括捆綁導入和幾個包導入,但bundlor auto會檢測我的包使用的類,併爲它們生成包導入,包括Import-Bundle標頭中的包。如何使maven包含使用我的MANIFEST.MF而不是使用模板和類型檢測?

有沒有辦法告訴bundlor只是使用我已建的MANIFEST.MF或禁用java類型自動檢測?

回答

4

那麼,只是不要使用bundlor呢?像文件中說,「Bundlor的主要功能是掃描現有的JAR文件,並確定其運行時依賴。」

例如,與Maven束-插件(在這個例子中,我有一個.war文件,但是這不應該的問題)

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-war-plugin</artifactId> 
    <configuration> 
     <archive> 
      <!-- add the generated manifest to the war --> 
      <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> 
     </archive> 
     <failOnMissingWebXml>true</failOnMissingWebXml> 
     <packagingExcludes>WEB-INF/web.xml</packagingExcludes> 
    </configuration> 
</plugin> 
<plugin> 
    <groupId>org.apache.felix</groupId> 
    <artifactId>maven-bundle-plugin</artifactId> 
    <extensions>true</extensions> 
    <executions> 
     <execution> 
     <id>bundle-manifest</id> 
     <phase>process-classes</phase> 
     <goals> 
      <goal>manifest</goal> 
     </goals> 
     </execution> 
    </executions> 
    <configuration> 
     <supportedProjectTypes> 
      <supportedProjectType>jar</supportedProjectType> 
      <supportedProjectType>bundle</supportedProjectType> 
      <supportedProjectType>war</supportedProjectType> 
     </supportedProjectTypes> 
     <instructions> 
      <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> 
      <Bundle-ClassPath>.,WEB-INF/classes,{maven-dependencies}</Bundle-ClassPath> 
      <Bundle-ManifestVersion>2</Bundle-ManifestVersion> 
      <Embed-Directory>WEB-INF/lib</Embed-Directory> 
      <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency> 
      <Embed-Transitive>true</Embed-Transitive> 
      <Import-Package> 
       javax.annotation, 
       javax.servlet;version="[2.5,3.0]", 
       javax.servlet.http;version="[2.5,3.0]", 
       org.osgi.service.http, 
       org.osgi.service.packageadmin, 
       org.osgi.framework;version="[1.5,2.0)", 
       org.jboss.logging;version="[3.0,4.0)" 
      </Import-Package> 
      <Private-Package>fi.eis.applications</Private-Package> 
      <Web-ContextPath>/spring-app</Web-ContextPath> 
     </instructions> 
    </configuration> 
</plugin> 

我可能已經離開了Maven的捆綁,插件也不確定的,只是放在WEB-INF的清單文件。

+1

是的,你是對的,我實際上不需要bundlor,感到困惑,忘記了我只需要用我的MENIFEST.MF創建一個jar,所以只需要maven jar插件就足夠了。謝謝。 –

相關問題