Maven snippets

Quick cut-and-paste snippets to enjoy all the power of maven!

Language level & UTF8

<properties>
  <maven.compiler.source>1.7</maven.compiler.source>
  <maven.compiler.target>1.7</maven.compiler.target>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Or configure the maven-compiler-plugin

<plugins>
 <plugin>
 <artifactId>maven-compiler-plugin</artifactId>
 <configuration>
 <source>1.7</source>
 <target>1.7</target>
 <encoding>UTF-8</encoding>
 </configuration>
 </plugin>
</plugins>

Add classes to unit tests

<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-surefire-plugin</artifactId>
 <version>2.19.1</version>
 <configuration>
  <includes>
   <include>**/Test*.java</include>
   <include>**/*Test.java</include>
   <include>**/**TestCase.java</include>
   <include>it.bytefox.test.e2e/*.java</include>
  </includes>
 </configuration>
</plugin>

Webservice client from WSDL with CXF

<plugin>
 <groupId>org.apache.cxf</groupId>
 <artifactId>cxf-codegen-plugin</artifactId>
 <!-- Versione 3.0.x per compatibilita' java6, 3.1.4 versione corrente -->
 <version>3.0.5</version>
 <executions>
  <execution>
   <id>generate-sources</id>
   <phase>generate-sources</phase>
   <goals>
    <goal>wsdl2java</goal>
   </goals>
   <configuration>
    <sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
    <wsdlOptions>
     <wsdlOption>
      <wsdl>${jaxws-maven-plugin.wsdlUrl}</wsdl>
      <extraargs>
       <extraarg>-client</extraarg>
       <extraarg>-verbose</extraarg>

       <!-- cxf default is JAX-WS-2.2 but JAVA 6 supports JAX-WS 2.1 API -->
       <extraarg>-fe</extraarg>
       <extraarg>jaxws21</extraarg>

       <extraarg>-p</extraarg>
       <extraarg>http://tempuri.org/=my.package</extraarg>
       <extraarg>-p</extraarg>
       <extraarg>http://tempuri.org/FooBar.xsd=my.package</extraarg>
      </extraargs>
     </wsdlOption>
    </wsdlOptions>
   </configuration>
  </execution>
 </executions>
</plugin>