how to develop, build and deploy multiple OSGi bas

2020-07-23 09:26发布

问题:

I'm search for a way to develop, build and deploy multiple OSGi based web applications (some RAP).

To start I use the RAP examples cloned from: https://github.com/eclipse/rap.git

In releng/org.eclipse.rap.examples.build there are three applications which can be built as war files using:

mvn clean verify

The resulting war files include all the dependencies and the required equinox servletbridge for the OSGi environment.
Now I can copy the war files and drop them into the webapps of the application server e.g. tomcat:

rapdemo.war > http://127.0.0.1:8080/rapdemo/
workbench.war > http://127.0.0.1:8080/workbench/
controls.war > http://127.0.0.1:8080/controls/

This works great, but how can I develop in Eclipse and automatically deploying to the tomcat/jetty/... using the equinox servletbridge?

I tried using the jetty maven plugin, adding the following to the pom files:

<plugin>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>9.4.15.v20190215</version>
</plugin>

I get the following messages in the console and jetty is not running:

[INFO] Skipping org.eclipse.rap.examples.rapdemo.product : packaging type [eclipse-repository] is unsupported ...
[INFO] Skipping RAP demo examples build : packaging type [pom] is unsupported

Maybe I need additional maven projects with packaging type war and a similiar configuration like this:

<configuration>
    <scanIntervalSeconds>10</scanIntervalSeconds>
    <webApp>
        <contextPath>/</contextPath>
    </webApp>
    <contextHandlers>
        <contextHandler
            implementation="org.eclipse.jetty.maven.plugin.JettyWebAppContext">
            <war>${project.basedir}/rapdemo/target/rapdemo.war</war>
            <contextPath>/rapdemo</contextPath>
        </contextHandler>
        ...
    </contextHandlers>
</configuration>