首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何让maven bundlor使用我的MANIFEST.MF而不是使用模板和类型检测?

如何让maven bundlor使用我的MANIFEST.MF而不是使用模板和类型检测?
EN

Stack Overflow用户
提问于 2012-12-28 14:34:24
回答 1查看 855关注 0票数 0

我正在与处女座开发一个OSGi应用程序,并使用maven bundles来构建包。我想使用Virgo使用的MANIFEST.MF,它包括包导入和一些包导入,但是bundles自动检测我的包使用的类,并为它们生成包导入,包括来自Import-Bundle header中的包的类。

有没有办法告诉bundlor只使用我已经构建的MANIFEST.MF,或者禁用java类型自动检测?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-12-28 15:16:47

好吧,那就别用bundlor了?正如文档中所说,“Bundlor的主要功能是扫描现有的JAR文件并确定其运行时依赖项。”,

例如,使用maven-bundle-plugin (在本例中,我有一个.war文件,但这无关紧要)

代码语言:javascript
复制
<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-bundle-plugin,而只是在WEB-INF中放置了一个清单文件。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14065606

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档