Fork me on GitHub

Using JAX-WS 2.2.x on JDK 6

<project>
  ...
  <dependencies>
      ...
    <dependency>
      <groupId>com.sun.xml.ws</groupId>
      <artifactId>jaxws-rt</artifactId>
      <version>2.2.10</version>
    </dependency>
    ...
  </dependencies>
  ...
  <profiles>
    ...
    <profile>
      <id>jdk6</id>
      <activation>
        <!-- needed only on JDK 6-->
        <jdk>1.6</jdk>
      </activation>
      <properties>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.3</version>
            <executions>
              <execution>
                <phase>validate</phase>
                <goals>
                  <goal>copy</goal>
                </goals>
                <configuration>
                  <outputDirectory>${endorsed.dir}</outputDirectory>
                  <silent>true</silent>
                  <!-- need JAXB API and JAX-WS API in an endorsed dir-->
                  <artifactItems>
                    <artifactItem>
                      <groupId>javax.xml.bind</groupId>
                      <artifactId>jaxb-api</artifactId>
                      <version>2.2.7</version>
                      <type>jar</type>
                    </artifactItem>
                    <artifactItem>
                      <groupId>javax.xml.ws</groupId>
                      <artifactId>jaxws-api</artifactId>
                      <version>2.2.9</version>
                      <type>jar</type>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
              <source>1.6</source>
              <target>1.6</target>
              <compilerArguments>
                <!-- tell compiler to use endorsed dir -->
                <endorseddirs>${endorsed.dir}</endorseddirs>
              </compilerArguments>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    ...
  </profiles>
  ...
</project>