Skip to content

Instantly share code, notes, and snippets.

@bimargulies
Created July 23, 2015 19:27
Show Gist options
  • Save bimargulies/0bb22c4d2c1280f71d57 to your computer and use it in GitHub Desktop.
Save bimargulies/0bb22c4d2c1280f71d57 to your computer and use it in GitHub Desktop.
problems with maven and karaf
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>
<parent>
<artifactId>anvils-prototype</artifactId>
<groupId>com.basistech.ws</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>karaf-rest-service</artifactId>
<packaging>bundle</packaging>
<name>karaf-rest-service</name>
<description>Rosette SDK component(s) as a restful service in a
Karaf container.
</description>
<properties>
<cxf-version-range>[3.0.4,3.0.5)</cxf-version-range>
<fabric8.version>2.2.15</fabric8.version>
<jube.version>2.2.0</jube.version>
<docker.maven.plugin.version>0.13.1</docker.maven.plugin.version>
<cxf.version>3.0.4</cxf.version>
<camel.version>2.15.2</camel.version>
<karaf.version>4.0.0</karaf.version>
<karaf.plugin.version>2.4.3</karaf.plugin.version>
<validation-api-version>1.1.0.Final</validation-api-version>
<json4s-version>3.2.4_1</json4s-version>
<reflections-version>0.9.8_1</reflections-version>
<jackson-module-scala-version>2.1.5_2</jackson-module-scala-version>
<swagger-scala-version>2.10.2</swagger-scala-version>
<docker.from>docker.io/fabric8/karaf-2.4</docker.from>
<fabric8.dockerPrefix>docker.io/</fabric8.dockerPrefix>
<fabric8.dockerUser>fabric8/</fabric8.dockerUser>
<docker.image>${fabric8.dockerPrefix}${fabric8.dockerUser}${project.artifactId}:${project.version}</docker.image>
<docker.assemblyDescriptor>${basedir}/src/assembly/assembly.xml</docker.assemblyDescriptor>
<docker.port.container.jolokia>8778</docker.port.container.jolokia>
<docker.port.container.http>8181</docker.port.container.http>
<!--
<fabric8.service.name>anvil</fabric8.service.name>
<fabric8.service.port>9412</fabric8.service.port>
<fabric8.service.containerPort>8181</fabric8.service.containerPort>
<fabric8.label.component>${project.artifactId}</fabric8.label.component>
<fabric8.label.container>karaf</fabric8.label.container>
<fabric8.label.group>anvil</fabric8.label.group>
<fabric8.iconRef>karaf</fabric8.iconRef>
-->
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-project</artifactId>
<version>${fabric8.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!--
For logging, we will use SLF4J, which is also available in the container by default.
-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
</dependency>
<!--
Add the slf4j-log4j12 dependency jar for testing
-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jaxrs_2.10</artifactId>
<version>1.3.0</version>
<optional>true</optional>
<exclusions>
<!-- avoid this old dependency which breaks CXF -->
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
</dependency>
<dependency>
<groupId>com.basistech</groupId>
<artifactId>adm-model-osgi</artifactId>
<version>${bt-adm-version}</version>
</dependency>
<dependency>
<groupId>com.basistech</groupId>
<artifactId>adm-json-osgi</artifactId>
<version>${bt-adm-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.basistech.osgi</groupId>
<artifactId>rosette-osgi-api</artifactId>
<version>${rosette-osgi-version}</version>
</dependency>
<dependency>
<groupId>com.basistech.osgi</groupId>
<artifactId>rosette-osgi-api-impl</artifactId>
<version>${rosette-osgi-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>
<dependency>
<groupId>com.basistech.rbl</groupId>
<artifactId>rbl-osgi</artifactId>
<version>7.13.102.c57.0</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>filter-extra-resources</id>
<goals>
<goal>copy-resources</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<outputDirectory>${project.build.directory}/karaf/etc</outputDirectory>
<resources>
<resource>
<directory>src/main/data</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>filter</id>
<phase>generate-resources</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Need to setup the OSGi meta information here -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>
javax.ws.rs;version="[2, 3)",
javax.ws.rs.core;version="[2, 3)",
javax.ws.rs.ext;version="[2, 3)",
javax.xml.bind.annotation,
org.osgi.service.blueprint,
com.wordnik.swagger.jaxrs.config,
com.wordnik.swagger.jaxrs.listing,
com.wordnik.swagger.annotations,
org.apache.cxf.transport.http,
io.fabric8.cxf.endpoint,
com.fasterxml.jackson.annotation,
com.fasterxml.jackson.core,
com.fasterxml.jackson.databind,
com.fasterxml.jackson.dataformat.yaml,
com.fasterxml.jackson.jaxrs.json, *
</Import-Package>
<Import-Service>org.apache.cxf.transport.http.DestinationRegistry</Import-Service>
<Export-Package>
com.basistech.raas
</Export-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-java2wadl-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>parsejavadoc</id>
<phase>generate-sources</phase>
<goals>
<goal>parsejavadoc</goal>
</goals>
</execution>
<execution>
<id>process-classes</id>
<phase>process-classes</phase>
<goals>
<goal>java2wadl</goal>
</goals>
<configuration>
<classResourceNames>
<classResourceName>com.basistech.raas.annotatorservice.AnnotatorService
</classResourceName>
</classResourceNames>
<docProvider>org.apache.cxf.maven_plugin.javatowadl.ResourceMapJavaDocProvider</docProvider>
<attachWadl>false</attachWadl>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>features-maven-plugin</artifactId>
<version>${karaf.plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http-lightweight</artifactId>
<version>2.9</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>add-features-to-repo</id>
<phase>package</phase>
<goals>
<goal>add-features-to-repo</goal>
</goals>
<!-- We populate the offline repository -->
<configuration>
<descriptors>
<descriptor>file://${project.build.directory}/karaf/etc/features.xml</descriptor>
</descriptors>
<repository>target/karaf/repository/</repository>
<addTransitiveFeatures>true</addTransitiveFeatures>
<features>
<feature>${project.artifactId}</feature>
</features>
</configuration>
</execution>
<execution>
<id>create-kar</id>
<phase>package</phase>
<goals>
<goal>create-kar</goal>
</goals>
<configuration>
<featuresFile>${project.build.directory}/karaf/etc/features.xml</featuresFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jolokia</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker.maven.plugin.version}</version>
<configuration>
<images>
<image>
<name>${docker.image}</name>
<build>
<from>${docker.from}</from>
<assembly>
<descriptor>${docker.assemblyDescriptor}</descriptor>
<basedir>/opt/jboss/deploy/</basedir>
</assembly>
<cmd>
<shell>/usr/bin/deploy-and-start</shell>
</cmd>
</build>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker-build</id>
<build>
<plugins>
<plugin>
<groupId>org.jolokia</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker.maven.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>docker-push</id>
<build>
<plugins>
<plugin>
<groupId>org.jolokia</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker.maven.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment