All Downloads are FREE. Search and download functionalities are using the official Maven repository.

archetype-resources.pom.xml Maven / Gradle / Ivy

Go to download

Creates a new CXF JAX-RS using CDI running in a standalone Java Container

There is a newer version: 2.2.197
Show newest version
<?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>

  <version>${version}</version>
  <groupId>${groupId}</groupId>
  <artifactId>${artifactId}</artifactId>
  <packaging>jar</packaging>

  <name>Fabric8 :: Quickstarts :: CDI :: CXF JAX-RS</name>
  <description>CXF JAX-RS using CDI running in a standalone Java Container</description>

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

    <!-- fabric8 version -->
    <fabric8.version>2.2.89</fabric8.version>
    <docker.maven.plugin.version>0.13.8</docker.maven.plugin.version>



    <!-- configure the versions you want to use here -->
    <cxf.version>${cxf-version}</cxf.version>
    <cxf.plugin.version>${cxf-plugin-version}</cxf.plugin.version>
    <jetty-version>9.2.10.v20150310</jetty-version>
    <weld.version>${weld-version}</weld.version>
    <slf4j-version>1.7.12</slf4j-version>
    <swagger-version>1.5.4</swagger-version>

    <http.port>9092</http.port>

    <!-- Docker & Fabric8 Configs -->
    <docker.from>fabric8/s2i-java:1.2</docker.from>
    <fabric8.dockerUser>fabric8/</fabric8.dockerUser>
    <docker.image>${fabric8.dockerUser}${project.artifactId}:${project.version}</docker.image>
    <docker.port.container.http>${http.port}</docker.port.container.http>
    <docker.port.container.jolokia>8778</docker.port.container.jolokia>
    <docker.port.container.metrics>9779</docker.port.container.metrics>

    <fabric8.service.name>${project.artifactId}</fabric8.service.name>
    <fabric8.service.port>80</fabric8.service.port>
    <fabric8.service.containerPort>${http.port}</fabric8.service.containerPort>
    <fabric8.service.type>LoadBalancer</fabric8.service.type>

    <fabric8.annotations.service.apiman.io.servicePath>cxfcdi</fabric8.annotations.service.apiman.io.servicePath>
    <fabric8.annotations.service.apiman.io.serviceType>REST</fabric8.annotations.service.apiman.io.serviceType>
    <fabric8.annotations.service.apiman.io.descriptionPath>cxfcdi/swagger.json</fabric8.annotations.service.apiman.io.descriptionPath>
    <fabric8.annotations.service.apiman.io.descriptionType>SwaggerJSON</fabric8.annotations.service.apiman.io.descriptionType>

    <fabric8.metrics.scrape>true</fabric8.metrics.scrape>
    <fabric8.metrics.port>9779</fabric8.metrics.port>

    <fabric8.label.container>java</fabric8.label.container>
    <fabric8.label.group>quickstarts</fabric8.label.group>
    <fabric8.label.component>${project.artifactId}</fabric8.label.component>
    <fabric8.label.container>java</fabric8.label.container>
    <fabric8.label.group>quickstarts</fabric8.label.group>
    <fabric8.iconRef>java</fabric8.iconRef>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.fabric8</groupId>
        <artifactId>fabric8-project-bom-with-platform-deps</artifactId>
        <version>${fabric8.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>


  <dependencies>

    <!-- fabric8 -->
    <dependency>
      <groupId>io.fabric8</groupId>
      <artifactId>fabric8-cxf</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.apache.cxf</groupId>
          <artifactId>cxf-bundle</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>io.fabric8</groupId>
      <artifactId>fabric8-utils</artifactId>
    </dependency>

    <!-- cxf -->
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-core</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-frontend-jaxws</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-bindings-soap</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-databinding-jaxb</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-bindings-xml</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-frontend-simple</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-ws-addr</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-rs-client</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-ws-policy</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-transports-local</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-transports-http-jetty</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-rs-service-description</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-integration-cdi</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-frontend-jaxrs</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-transports-http</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-management</artifactId>
      <version>${cxf.version}</version>
    </dependency>

    <!-- cdi api -->
    <dependency>
      <groupId>javax.enterprise</groupId>
      <artifactId>cdi-api</artifactId>
      <version>1.2</version>
      <scope>provided</scope>
    </dependency>

    <!-- cdi container -->
    <dependency>
      <groupId>org.jboss.weld.se</groupId>
      <artifactId>weld-se</artifactId>
      <version>${weld.version}</version>
    </dependency>
    <dependency>
      <groupId>org.jboss.weld</groupId>
      <artifactId>weld-core</artifactId>
      <version>${weld.version}</version>
    </dependency>
    <dependency>
      <groupId>org.jboss.weld.servlet</groupId>
      <artifactId>weld-servlet</artifactId>
      <version>${weld.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.deltaspike.cdictrl</groupId>
      <artifactId>deltaspike-cdictrl-weld</artifactId>
    </dependency>

    <!-- these explicit transitive dependencies avoid issues of 8.x bleeding into the generated archetype
         WARNING - this quickstart fails with jetty-8.x, the symptoms are that the endpoints are not registered. -->
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
      <version>${jetty-version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlet</artifactId>
      <version>${jetty-version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlets</artifactId>
      <version>${jetty-version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-jndi</artifactId>
      <version>${jetty-version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-jsp</artifactId>
      <version>${jetty-version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-http</artifactId>
      <version>${jetty-version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-io</artifactId>
      <version>${jetty-version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-util</artifactId>
      <version>${jetty-version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-security</artifactId>
      <version>${jetty-version}</version>
    </dependency>

    <dependency>
      <groupId>io.swagger</groupId>
      <artifactId>swagger-jaxrs</artifactId>
      <version>${swagger-version}</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>

    <!-- logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j-version}</version>
    </dependency>

    <!-- testing -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>${slf4j-version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.junit</groupId>
      <artifactId>arquillian-junit-container</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.fabric8</groupId>
      <artifactId>fabric8-arquillian</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <finalName>${project.artifactId}</finalName>

    <plugins>
      <!-- Compiler plugin enforces Java 1.7 compatibility and activates annotation processors -->
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.18.1</version>
        <inherited>true</inherited>
        <configuration>
          <excludes>
            <exclude>**/*KT.java</exclude>
          </excludes>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.7</version>
        <executions>
          <execution>
            <id>filter</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>resources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-java2wadl-plugin</artifactId>
        <version>${cxf.plugin.version}</version>
        <executions>
          <execution>
            <id>process-classes</id>
            <phase>process-classes</phase>
            <goals>
              <goal>java2wadl</goal>
            </goals>
            <configuration>
              <classResourceNames>
                <classResourceName>${package}.CustomerService</classResourceName>
              </classResourceNames>
              <attachWadl>false</attachWadl>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>fabric8-maven-plugin</artifactId>
        <version>${fabric8.version}</version>
        <executions>
          <execution>
            <id>json</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>json</goal>
            </goals>
          </execution>
          <execution>
            <id>attach</id>
            <phase>package</phase>
            <goals>
              <goal>attach</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>hawt-app-maven-plugin</artifactId>
        <version>${fabric8.version}</version>
        <executions>
          <execution>
            <id>hawt-app</id>
            <goals>
              <goal>build</goal>
            </goals>
            <configuration>
              <javaMainClass>${package}.ApplicationStarter</javaMainClass>
            </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>
                  <basedir>/deployments</basedir>
                  <descriptorRef>hawt-app</descriptorRef>
                </assembly>
                <env>
                  <JAVA_LIB_DIR>/deployments/lib</JAVA_LIB_DIR>
                  <JAVA_MAIN_CLASS>${package}.ApplicationStarter</JAVA_MAIN_CLASS>
                  <HTTP_PORT>${http.port}</HTTP_PORT>
                </env>
                <ports>
                  <port>${http.port}</port>
                </ports>
              </build>
            </image>
          </images>
        </configuration>
      </plugin>

      <!-- allows the route to be ran via 'mvn exec:java' -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.4.0</version>
        <configuration>
          <mainClass>${package}.ApplicationStarter</mainClass>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <!--
  Default sample commands:

  mvn -Pf8-build         ... build Docker images and create OpenShift deployment configs
  mvn -Pf8-deploy        ... f8-build + push to Docker registry + applying deployment config to OpenShift
  mvn -Pf8-local-deploy ... deployment for a single node setup without pushing to a registry

  For individual goal usage please consult the fabric8 documentation
  -->
  <profiles>
    <profile>
      <id>f8-build</id>
      <build>
        <defaultGoal>clean install docker:build fabric8:json</defaultGoal>
      </build>
    </profile>
    <profile>
      <id>f8-deploy</id>
      <properties>
        <fabric8.imagePullPolicySnapshot>Always</fabric8.imagePullPolicySnapshot>
        <fabric8.recreate>true</fabric8.recreate>
      </properties>
      <build>
        <defaultGoal>clean install docker:build docker:push fabric8:json fabric8:apply</defaultGoal>
      </build>
    </profile>
    <profile>
      <id>f8-local-deploy</id>
      <properties>
        <fabric8.recreate>true</fabric8.recreate>
      </properties>
      <build>
        <defaultGoal>clean install docker:build fabric8:json fabric8:apply</defaultGoal>
      </build>
    </profile>
  </profiles>

</project>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy