简体   繁体   English

如何在NetBeans 7.4中创建Maven WAB(war as osgi bundle)项目?

[英]How to create maven wab (war as osgi bundle) project in netbeans 7.4?

I am sorry if my question is so simple, but I can't find it in netbeans. 如果我的问题这么简单,很抱歉,但是我在netbeans中找不到。 Does such project exist? 是否存在这样的项目? If no, how do you create it? 如果没有,您如何创建它?

As I understand there are two ways - 1)create maven osgi project and then edit it or 2)create maven war project and then edit it. 据我了解,有两种方法-1)创建maven osgi项目,然后对其进行编辑,或者2)创建maven war项目,然后对其进行编辑。 Which is better? 哪个更好?

Not quite sure if this is what you really looking for, but you can package osgi bundles with maven-bundle-plugin . 不太确定这是否是您真正想要的东西,但是您可以将osgi包与maven-bundle-plugin打包在一起。 Downside is a sample for a basic project: 缺点是一个基本项目的样本:

<project xmlns="http://maven.apache.org/POM/4.0.0"...>
  <groupId>some.group.id</groupId>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>sample</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>bundle</packaging>
  <name>Sample</name>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.4.0</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-SymbolicName>
              <Bundle-Name>${pom.name}</Bundle-Name>
              <Bundle-Version>${pom.version}</Bundle-Version>
              <Bundle-Activator>package.name.Activator</Bundle-Activator>
              <Private-Package>package.name.sample</Private-Package>
          </instructions>
        </configuration          
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.osgi.core</artifactId>
    </dependency>
  </dependencies>

</project>

Here you can refer to the documentation . 在这里您可以参考文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM