Reputation: 2375
I have written an incredibly simple (no java files) war file which I am hoping to deploy to servicemix. It has the following directory structure:
.
|-src
|-main
|-webapp
|-css
|-js
|-WEB-INF
\-web.xml
\-index.html
\-pom.xml
I am able to deploy this to the jetty container running in ServiceMix using the following commands:
>install war:file:///<Fully qualified war location>?Webapp-Context=<Application name>
>osgi:start <Bundle id>
>http://localhost:8181/<Application name>/index.html
What I would prefer is to hot-deploy as I do with the rest of my bundles. What should the pom.xml look like? The simpler the better.
Upvotes: 1
Views: 5149
Reputation: 2375
This has done the trick for me (although I did need to add a placeholder java file to ensure target/classes was generated):
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<supportedProjectTypes>
<supportedProjectType>jar</supportedProjectType>
<supportedProjectType>bundle</supportedProjectType>
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Bundle-Version>${pom.version}</Bundle-Version>
<Webapp-Context>webclient</Webapp-Context>
<_include>-osgi.bnd</_include>
</instructions>
</configuration>
</plugin>
</plugins>
Upvotes: 1
Reputation: 8963
I had a similar requirement (just Karaf, not ServiceMix). Mine looks like this:
Edit: See ben1729's answer for addition bundle plugin configuration. I had forgotten that part because it was in my parent pom.xml for all of my modules.
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<!-- add the generated manifest to the war -->
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
<overlays>
<overlay>
<!-- empty groupId/artifactId represents the current build -->
<excludes>
<exclude>*</exclude>
</excludes>
</overlay>
</overlays>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Web-ContextPath>/base/url</Web-ContextPath>
</instructions>
</configuration>
</plugin>
</plugins>
Upvotes: 2