带有ApacheFelix插件的Maven Web项目

带有ApacheFelix插件的Maven Web项目,maven,osgi,apache-felix,osgi-bundle,eclipse-virgo,Maven,Osgi,Apache Felix,Osgi Bundle,Eclipse Virgo,使用maven创建简单osgi(部署到virgo服务器)项目的最佳方法是什么?使用pom.xml maven描述符创建war结构 结构目标是 *.jsp *.html META-INF MANIFEST (OSGI-CONFIG) WEB-INF classes lib web.xml 然后当我创建一个项目时 这是我的pom.xml 项目属性 com.aaaa 第一个maven-virgo项目 1.0.0 战争 Felix插件 org.apache.felix maven捆绑插

使用maven创建简单osgi(部署到virgo服务器)项目的最佳方法是什么?使用pom.xml maven描述符创建war结构

结构目标是

*.jsp
*.html
META-INF
MANIFEST (OSGI-CONFIG)
WEB-INF
  classes
  lib
  web.xml
然后当我创建一个项目时

这是我的pom.xml

项目属性

com.aaaa
第一个maven-virgo项目
1.0.0
战争
Felix插件


org.apache.felix
maven捆绑插件
真的
战争
com.roshka.servlet
${project.artifactId}
,WEB-INF/classes,{maven dependencies}
WEB-INF/lib
*;范围=编译|运行时;
真的
/你好
你好
但是,当我执行
mvn install
时,包不会创建
MANIFEST
文件,以将其打包到METAINF文件夹中

我的felix项目怎么了?创建OSGI包和WAR OSGI包的典型pom.xml模板是什么


p、 如果我将WAR更改为捆绑到打包Maven描述符中,JAR生成的工作正常,而清单生成的工作正常。但这不是WEB结构。

我的问题已经用下一个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.aaaa</groupId>
<artifactId>first-maven-virgo-project</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>

<description>http://localhost:8090/system/console/bundles</description>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>

    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>

    <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>tomcat-servlet-api</artifactId>
        <version>7.0.42</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>org.osgi.core</artifactId>
        <version>4.2.0</version>
        <scope>provided</scope>
    </dependency>

</dependencies>
<build>
    <plugins>

        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
                <archive>
                    <manifestFile>./src/main/webapp/META-INF/MANIFEST.MF</manifestFile>
                </archive>
            </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>war</supportedProjectType>
                </supportedProjectTypes>
                <manifestLocation>./src/main/webapp/META-INF</manifestLocation>
                <instructions>
                    <Export-Package>com.roshka.servlet</Export-Package>
                    <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                    <Bundle-ClassPath>.,WEB-INF/classes,{maven-dependencies}</Bundle-ClassPath>
                    <Embed-Directory>WEB-INF/lib</Embed-Directory>
                    <Embed-Dependency>*;scope=compile|runtime;</Embed-Dependency>
                    <Embed-Transitive>true</Embed-Transitive>
                    <Web-ContextPath>/hello</Web-ContextPath>
                    <Webapp-Context>hello</Webapp-Context>
                </instructions>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>

                    <id>copy-dependencies</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <Import-Package>javax.servlet,javax.servlet.http,javax.servlet.*,javax.servlet.jsp.*,javax.servlet.jsp.jstl.*,*</Import-Package>
                        <outputDirectory>./src/main/resources/WEB-INF/lib</outputDirectory>
                        <overWriteReleases>false</overWriteReleases>
                        <overWriteSnapshots>false</overWriteSnapshots>
                        <overWriteIfNewer>true</overWriteIfNewer>
                        <actTransitively>true</actTransitively>
                        <excludeScope>provided</excludeScope>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <!-- Enable this plugin for all modules -->
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
        </plugin>
    </plugins>
</build>

4.0.0
com.aaaa
第一个maven-virgo项目
1.0.0
战争
http://localhost:8090/system/console/bundles
UTF-8
公地郎
公地郎
2.6
org.apache.tomcat
TomcatServletAPI
7.0.42
假如
org.osgi
org.osgi.core
4.2.0
假如
maven编译器插件
1.6
1.6
org.apache.maven.plugins
maven战争插件
./src/main/webapp/META-INF/MANIFEST.MF
org.apache.felix
maven捆绑插件
真的
捆绑清单
进程类
显示
战争
./src/main/webapp/META-INF
com.roshka.servlet
${project.artifactId}
,WEB-INF/classes,{maven dependencies}
WEB-INF/lib
*;范围=编译|运行时;
真的
/你好
你好
org.apache.maven.plugins
maven依赖插件
复制依赖项
包裹
复制依赖项
servlet,javax.servlet.http,javax.servlet.*,javax.servlet.jsp.*,javax.servlet.jsp.jstl.**
./src/main/resources/WEB-INF/lib
假的
假的
真的
真的
假如
org.apache.felix
maven捆绑插件

IBM提供了一个答案,它一步一步地描述了流程。在给定war的情况下,可以开发一个脚本来创建捆绑包,我用java编写了一个脚本,作为构建步骤调用


一个关键的区别是IBM步骤将成品作为jar,而jrey将其作为war文件。这可能是因为IBM的步骤可能导致进一步的CICS绑定,据我所知,这需要JAR,至少在使用RAD环境时是这样

谢谢你的帮助