Maven 2

Maven 2

Common Maven 2 commands

mvn clean
mvn install

Public Maven 2 repos

http://repo1.maven.org/maven2/
http://repo2.maven.org/maven2/
http://caucho.com/m2/
http://caucho.com/m2-snapshot/

Using the archetype plugin

Using the cxf-codegen-plugin

Description

Setting up the pom.xml for mvn

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>campaignmonitor-client</groupId>
  <artifactId>campaignmonitor-client</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>campaignmonitor-client</name>

  <!-- REFERENCE: http://cxf.apache.org/docs/using-cxf-with-maven.html                  -->
  <!-- REFERENCE: http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html -->
  <!-- REFERENCE: http://cxf.apache.org/docs/wsdl-to-java.html                          -->
  
  <!-- BEGIN: CXF versioning -->
  <properties>
    <cxf.version>2.2.3</cxf.version>
  </properties>
  <!-- END: CXF versioning -->
  
  <distributionManagement>
    <repository>
      <uniqueVersion>false</uniqueVersion>
      <id>build.dev</id>
      <name>Exchange Solutions Maven Repository</name>
      <url>scp://build.dev.valuex.com/export/home/buildmgr/builds-publish/stable-repo</url>
      <layout>legacy</layout>
    </repository>
  </distributionManagement>
	
  <pluginRepositories>
    <pluginRepository>
      <id>apache-plugin-snapshots</id>
      <name>Apache Maven Plugin Snapshots</name>
      <url>http://people.apache.org/repo/m2-snapshot-repository</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
    <pluginRepository>
      <id>apache-plugin-incubating</id>
      <name>Apache Plugin Incubating Repository</name>
      <url>http://people.apache.org/repo/m2-incubating-repository/</url>
    </pluginRepository>
  </pluginRepositories>
	
  <dependencies>
  

    <!-- BEGIN: CXF dependencies -->
    
    <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-transports-http</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    
    <!-- Jetty is needed if you're are not using the CXFServlet -->
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-transports-http-jetty</artifactId>
      <version>${cxf.version}</version>
    </dependency>
    
    <!-- END: CXF dependencies -->
  		
  		
    <!-- BEGIN: Spring dependencies -->
    
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring</artifactId>
      <version>2.0.8</version>
    </dependency>
    
    <!-- END: Spring dependencies -->
    
    
    <!-- BEGIN: standard dependencies -->
    
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
    </dependency>
    
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.13</version>
    </dependency>
    
    <!-- END: standard dependencies -->


  </dependencies>

  <build>
	
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
      <resource>
        <directory>src/main/config</directory>
      </resource>
    </resources>
    
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
      </testResource>
      <testResource>
        <directory>src/test/config</directory>
      </testResource>
    </testResources>
    
    <plugins>
    
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
      
      <plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-codegen-plugin</artifactId>
        <version>${cxf.version}</version>
        <executions>
          <execution>
            <id>generate-sources</id>

            <configuration>
              <sourceRoot>${basedir}/src/main/java</sourceRoot>
              <wsdlOptions>
                <wsdlOption>
                  <wsdl>${basedir}/src/main/resources/campaignmonitor.wsdl</wsdl>
                  <bindingFiles>
                    <bindingFile>${basedir}/src/main/resources/wsdl-customization.xml</bindingFile>
                  </bindingFiles>
                </wsdlOption>
              </wsdlOptions>
            </configuration>
            
            <goals>
              <goal>wsdl2java</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <groups>functest,perftest</groups>
          <!--
          <excludes>
            <exclude>**/SomeTest.java</exclude>
          </excludes>
          -->
        </configuration>
      </plugin>
      
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-scm-plugin</artifactId>
        <version>1.0</version>
      </plugin>
       
    </plugins>
  </build>
</project>

Setting up the binding file for jaxb

<?xml version="1.0" encoding="utf-8"?>

<!-- Based on:  http://github.com/jdennes/jcm/raw/master/wsdl-tools/wsdl-customization.xml -->
<!-- Using url: https://api.createsend.com/api/api.asmx?wsdl                               -->

<jaxws:bindings
    wsdlLocation="campaignmonitor.wsdl"
    xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    xsi:schemaLocation="
        http://java.sun.com/xml/ns/jaxws http://java.sun.com/xml/ns/jaxws/wsdl_customizationschema_2_0.xsd
        http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd">

    <jaxws:package name="com.campaignmonitor.api" />

    <jaxws:bindings node="wsdl:definitions/wsdl:portType[@name='apiSoap']">
        <jaxws:class name="CampaignMonitorApi" />
    </jaxws:bindings>

    <jaxws:bindings node="xs:schema[@targetNamespace='http://api.createsend.com/api/']">
      <jaxws:bindings node="xs:complexType[@name='SubscriberUnsubscribe']">
        <jaxb:class name="SubscriberUnsubscribeType"/>
      </jaxws:bindings>
      <jaxb:schemaBindings>
        <jaxb:package name="com.campaignmonitor.api.types"/>
      </jaxb:schemaBindings>
    </jaxws:bindings>

</jaxws:bindings>

Maven 2 cxf commands

mvn generate-sources

Browse Space

- Pages
- Blog
- Labels
- Attachments
- Bookmarks
- Mail
- Advanced

Explore Confluence

- Popular Labels
- Notation Guide

Your Account

Log In

 

Other Features

Add Content