logoff
logoff

Reputation: 3443

how to deploy Maven dependencies automatically into JBoss as OSGI bundles?

I have a project that deploys an standalone OSGí Apache ServiceMix application. It has tons of dependencies and it is built with Maven. Now I want to deploy this application into a JBoss AS. I found an interesting Maven plugin called jboss-as-maven-plugin (org.jboss.as.plugins) to deploy anything. I use maven-bundle-plugin (org.apache.felix) to construct my bundles and it works fine, but when I deploy the project bundles, the deployment fails because dependencies are not satisfied.

How can I automatically bundle and deploy all the dependency tree with a Maven goal? Is it possible? My project has dozens of dependencies declared on the pom.xml and some of them are other projects in my workspace.

Upvotes: 1

Views: 863

Answers (3)

TAYFUN ÇELİK
TAYFUN ÇELİK

Reputation: 31

You can autoinstall your bundles with org.apache.sling plugin

            <plugin>
                <groupId>org.apache.sling</groupId>
                <artifactId>maven-sling-plugin</artifactId>
                <executions>
                    <execution>
                        <id>install-bundle</id>
                        <goals>
                            <goal>install</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <slingUrl>http://localhost:8181/system/console/install</slingUrl>
                    <user>karaf</user>
                    <password>karaf</password>
                </configuration>
            </plugin>

you can find detailed pom.xml from Adobe website :https://docs.adobe.com/docs/en/cq/5-6-1/developing/developmenttools/how-to-build-aem-projects-using-apache-maven.html

or http://www.cqblueprints.com/tipsandtricks/build-and-deploy-osgi/build-deploy-osgi-1.html

Upvotes: 0

Claus Ibsen
Claus Ibsen

Reputation: 55555

If your application do not use OSGi per see, you may consider packing your application as a WAR which is deployable in JBoss.

Then you would need to use web.xml to bootstrap your application, such as using a Spring XML file.

There is a Camel example as a WAR here: http://camel.apache.org/servlet-tomcat-example.html

Upvotes: 0

Christian Schneider
Christian Schneider

Reputation: 19626

Currently the only solution to this I know are the Karaf features. You can create a feature file out of your pom dependencies.

I found that jboss seems to support subsystems. That may help to specify the bundles required to run your application. It does not seem to be the OSGi subsystem spec but for jboss this may already help. For OSGi spec 5 there is the standardized subsystem spec which may provide a standard way to do this across containers.

If jboss supports OBR (OSGi bundle repository) then you can limit the number of dependencies you have to specify.

Upvotes: 1

Related Questions