dev@wadl.java.net

Maven Support

From: Wilfred Springer <wilfred_at_agilejava.com>
Date: Fri, 13 Oct 2006 12:23:44 +0200

Hi Marc,

I am working on a Maven plugin for doing the WADL->Java transformation
and generating Maven reports from WADL files. In order to do that, I
have first needed the entire project to be built using Maven. Find the
pom.xml file inlined below and added as an attachment.

The Maven build is working fine, although it may require adding a couple
of files to your own Maven repository. (Maven will however instruct you
how to do that.)

As you can see down below, I've basically added most of the libraries in
the lib folder to the dependencies section of the pom.xml file. That
means that the Maven build is no longer dependent on the files being
present in lib; it will simply download them whenever they are required.

I did however notice that there are quite a few libraries in lib that
are not required for compilation. They may be needed at runtime, but
some of them seem not to be required at all. (Like the JSR 250 API
dependency.)

Note that the Maven pom.xml file will also build a zip file containing
everything required to run wadl2java from the commandline. (Haven't
tried the Windows .bat file yet though.)

<?xml version="1.0"?>
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>wadl</groupId>
  <artifactId>wadl2java</artifactId>
  <version>1.0-SNAPSHOT</version>
  <name>WADL Java</name>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.activation</groupId>
      <artifactId>activation</artifactId>
      <version>1.1</version>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.fastinfoset</groupId>
      <artifactId>FastInfoset</artifactId>
      <version>1.1.1</version>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-xjc</artifactId>
      <version>2.0.2</version>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-impl</artifactId>
      <version>2.0.2</version>
    </dependency>
    <dependency>
      <groupId>javax.xml.bind</groupId>
      <artifactId>jaxb-api</artifactId>
      <version>2.0</version>
    </dependency>
    <dependency>
      <groupId>javax.xml.ws</groupId>
      <artifactId>jaxws-api</artifactId>
      <version>2.1</version>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.ws</groupId>
      <artifactId>jaxws-rt</artifactId>
      <version>2.1EA1</version>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.ws</groupId>
      <artifactId>jaxws-tools</artifactId>
      <version>2.1EA1</version>
    </dependency>
    <dependency>
      <groupId>javax.xml.bind</groupId>
      <artifactId>jsr173_api</artifactId>
      <version>1.0</version>
    </dependency>
    <!-- Doesn't seem to be required. -->
    <!--
    <dependency>
      <groupId>javax.jws</groupId>
      <artifactId>jsr181</artifactId>
      <version>1.0</version>
    </dependency>
    -->
    <!-- Doesn't seem to be required. -->
    <!--
    <dependency>
      <groupId>javax.annotation</groupId>
      <artifactId>jsr250-api</artifactId>
      <version>1.0-20050927.133100</version>
    </dependency>
    -->
    <dependency>
      <groupId>ant</groupId>
      <artifactId>ant</artifactId>
      <version>1.6.5</version>
    </dependency>
  </dependencies>
  <pluginRepositories>
    <pluginRepository>
      <id>java.net</id>
      <url>https://maven-repository.dev.java.net/nonav/repository</url>
      <layout>legacy</layout>
    </pluginRepository>
  </pluginRepositories>
  <repositories>
    <repository>
      <id>java.net</id>
      <url>https://maven-repository.dev.java.net/nonav/repository</url>
      <layout>legacy</layout>
    </repository>
  </repositories>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <testSourceDirectory>test</testSourceDirectory>
    <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>com.sun.tools.xjc.maven2</groupId>
        <artifactId>maven-jaxb-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <schemaDirectory>.</schemaDirectory>
          <generatePackage>com.sun.research.ws.wadl</generatePackage>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <version>1.0-alpha-1</version>
        <artifactId>appassembler-maven-plugin</artifactId>
        <configuration>
          <programs>
            <program>
              <mainClass>com.sun.research.ws.wadl2java.Main</mainClass>
              <name>wadl2java</name>
            </program>
          </programs>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>assemble</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>run</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
        <configuration>
          <tasks>
            <zip zipfile="target/${project.build.finalName}.zip">
              <zipfileset prefix="${project.build.finalName}"
                          dir="target/appassembler"/>
            </zip>
          </tasks>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>