用BND和/或maven-bundle-plugin包装JAR

时间:2018-10-26 09:01:10

标签: java maven osgi bnd maven-bundle-plugin

我将一堆JAR包装到一个OSGi捆绑包中。有很多包,所以我尝试使用org.apache.myfaces.*语法。但是随后maven-bundle-plugin / bnd抱怨Exporting an empty package 'org.apache.myfaces.component'。有没有一种简便的方法可以导出所有非空软件包,而无需我实际检查所有软件包?

Maven Bundle插件配置:

<configuration>
    <supportedProjectTypes>
        <supportedProjectType>jar</supportedProjectType>
    </supportedProjectTypes>
    <instructions>
        <Export-Package>
            javax.el,
            javax.servlet,
            javax.servlet.annotation,
            javax.servlet.descriptor,
            javax.servlet.http,
            javax.servlet.jsp,
            javax.servlet.jsp.el,
            javax.servlet.jsp.jstl.core,
            javax.servlet.jsp.jstl.fmt,
            javax.servlet.jsp.jstl.sql,
            javax.servlet.jsp.jstl.tlv,
            javax.servlet.jsp.resources,
            javax.servlet.jsp.tagext,
            javax.servlet.resources,
            org.apache.el,
            org.apache.el.lang,
            org.apache.el.parser,
            org.apache.el.stream,
            org.apache.el.util,
            org.apache.jasper,
            org.apache.jasper.compiler,
            org.apache.jasper.compiler.tagplugin,
            org.apache.jasper.el,
            org.apache.jasper.resources,
            org.apache.jasper.runtime,
            org.apache.jasper.security,
            org.apache.jasper.servlet,
            org.apache.jasper.tagplugins.jstl,
            org.apache.jasper.tagplugins.jstl.core,
            org.apache.jasper.util,
            org.apache.jasper.xmlparser,
            org.apache.juli.logging,
            !org.apache.myfaces.custom.dojo.resource.src.*,
            org.apache.myfaces.*,
            javax.faces.*,
            org.apache.taglibs.standard,
            org.apache.taglibs.standard.functions,
            org.apache.taglibs.standard.resources,
            org.apache.taglibs.standard.tag.common.core,
            org.apache.taglibs.standard.tag.common.fmt,
            org.apache.taglibs.standard.tag.common.sql,
            org.apache.taglibs.standard.tag.common.xml,
            org.apache.taglibs.standard.tag.rt.core,
            org.apache.taglibs.standard.tag.rt.fmt,
            org.apache.taglibs.standard.tag.rt.sql,
            org.apache.taglibs.standard.tag.rt.xml,
            org.apache.taglibs.standard.tei,
            org.apache.taglibs.standard.tlv,
            org.apache.taglibs.standard.util,
            org.apache.tomcat,
            org.apache.tomcat.util,
            org.apache.tomcat.util.buf,
            org.apache.tomcat.util.descriptor.tagplugin,
            org.apache.tomcat.util.descriptor.tld,
            org.apache.tomcat.util.descriptor.web,
            org.apache.tomcat.util.digester,
            org.apache.tomcat.util.file,
            org.apache.tomcat.util.res,
            org.apache.tomcat.util.scan,
            org.apache.tomcat.util.security,
            org.eclipse.jetty.annotations,
            org.eclipse.jetty.apache.jsp,
            org.eclipse.jetty.http,
            org.eclipse.jetty.http.pathmap,
            org.eclipse.jetty.io,
            org.eclipse.jetty.io.ssl,
            org.eclipse.jetty.jndi,
            org.eclipse.jetty.jndi.factories,
            org.eclipse.jetty.jndi.java,
            org.eclipse.jetty.jndi.local,
            org.eclipse.jetty.jsp,
            org.eclipse.jetty.plus.annotation,
            org.eclipse.jetty.plus.jndi,
            org.eclipse.jetty.plus.security,
            org.eclipse.jetty.plus.webapp,
            org.eclipse.jetty.security,
            org.eclipse.jetty.security.authentication,
            org.eclipse.jetty.server,
            org.eclipse.jetty.server.handler,
            org.eclipse.jetty.server.handler.gzip,
            org.eclipse.jetty.server.handler.jmx,
            org.eclipse.jetty.server.jmx,
            org.eclipse.jetty.server.nio,
            org.eclipse.jetty.server.session,
            org.eclipse.jetty.servlet,
            org.eclipse.jetty.servlet.jmx,
            org.eclipse.jetty.servlet.listener,
            org.eclipse.jetty.servlets,
            org.eclipse.jetty.util,
            org.eclipse.jetty.util.annotation,
            org.eclipse.jetty.util.component,
            org.eclipse.jetty.util.log,
            org.eclipse.jetty.util.preventers,
            org.eclipse.jetty.util.resource,
            org.eclipse.jetty.util.security,
            org.eclipse.jetty.util.ssl,
            org.eclipse.jetty.util.statistic,
            org.eclipse.jetty.util.thread,
            org.eclipse.jetty.util.thread.strategy,
            org.eclipse.jetty.webapp,
            org.eclipse.jetty.xml,
            org.objectweb.asm,
            org.objectweb.asm.**,
            org.slf4j,
            org.slf4j.**
        </Export-Package>
        <!-- /Export-Package -->
        <Import-Package>
            org.slf4j,
            org.slf4j.**,
            !*
        </Import-Package>
        <Manifest-Version>1.0</Manifest-Version>
        <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
        <Require-Bundle>javax.servlet;visibility:=reexport</Require-Bundle>
        <Bundle-RequiredExecutionEnvironment>JavaSE-1.8</Bundle-RequiredExecutionEnvironment>
        <Bundle-Name>Jetty9 Plug-in</Bundle-Name>
        <Bundle-SymbolicName>org.mortbay.jetty</Bundle-SymbolicName>
        <Bundle-Version>${bundle.version}</Bundle-Version>
        <Bundle-Description>Jetty 9.x</Bundle-Description>
        <Eclipse-BuddyPolicy>registered</Eclipse-BuddyPolicy>
        <!-- Embed-Dependency>*;scope=compile|runtime;optional=false</Embed-Dependency -->
        <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
        <Embed-Transitive>true</Embed-Transitive>
        <!-- Embed-StripGroup>false</Embed-StripGroup -->
        <!-- Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy -->
        <_noee>true</_noee>
        <!-- _nouses>true</_nouses -->
        <_check>ALL</_check>
        <_reproducible>true</_reproducible>
    </instructions>
</configuration>

这将产生:

[INFO] --- maven-bundle-plugin:4.1.0:bundle (build-bundle) @ org.mortbay.jetty ---
[WARNING] Bundle <groupId>:org.mortbay.jetty:jar:9.4.11-2 : Import package org.slf4j.impl not found in any bundle on the -buildpath. List explicitly in Import-Package: p,* to get rid of this warning if false
[ERROR] Bundle <groupId>:org.mortbay.jetty:jar:9.4.11-2 : Exporting an empty package 'org.apache.myfaces.application'
[ERROR] Bundle <groupId>:org.mortbay.jetty:jar:9.4.11-2 : Exporting an empty package 'org.apache.myfaces.application.jsp'
[ERROR] Bundle <groupId>:org.mortbay.jetty:jar:9.4.11-2 : Exporting an empty package 'org.apache.myfaces.application.pss'
[ERROR] Bundle <groupId>:org.mortbay.jetty:jar:9.4.11-2 : Exporting an empty package 'org.apache.myfaces.component'
[ERROR] Bundle <groupId>:org.mortbay.jetty:jar:9.4.11-2 : Exporting an empty package 'org.apache.myfaces.component.html.ext'
[ERROR] Bundle <groupId>:org.mortbay.jetty:jar:9.4.11-2 : Exporting an empty package 'org.apache.myfaces.component.html.util'
[ERROR] Bundle <groupId>:org.mortbay.jetty:jar:9.4.11-2 : Exporting an empty package 'org.apache.myfaces.config'
...

0 个答案:

没有答案