Fork me on GitHub

Using Metro binaries

<project>
  ...
  <dependencies>
      ...
    <dependency>
      <groupId>org.glassfish.metro</groupId>
      <artifactId>webservices-rt</artifactId>
      <version>2.3.1</version>
    </dependency>
    ...
  </dependencies>
  ...
  <build>
    ...
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxws-maven-plugin</artifactId>
        <version>2.6</version>
        <dependencies>
          <dependency>
            <groupId>org.glassfish.metro</groupId>
            <artifactId>webservices-tools</artifactId>
            <version>2.3.1</version>
          </dependency>
          <!-- see https://java.net/jira/browse/WSIT-1672 -->
          <dependency>
            <groupId>org.glassfish.metro</groupId>
            <artifactId>webservices-rt</artifactId>
            <version>2.3.1</version>
          </dependency>
        </dependencies>
        <executions>
          ...
        </executions>
      </plugin>
      ...
    </plugins>
    ...
  <build>
  ...

  <!-- compilation on JDK 6 -->
  <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 new APIs in an endorsed dir -->
                  <artifactItems>
                    <artifactItem>
                      <groupId>org.glassfish.metro</groupId>
                      <artifactId>webservices-api</artifactId>
                      <version>2.3.1</version>
                      <type>jar</type>
                    </artifactItem>
                </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>