Fork me on GitHub

Usage

The wsdl2java goal will process all .wsdl files in the source directory.

Create sub packages based on WSDL file names

The <subPackageByFileName> configuration parameter will further nest the generated files into a subproject based on the filename of the .wsdl file. (ex. foo.bar.wsdl will go into a packagespace of packageSpace.foo.bar)

Use URLs with caution

If the <urls> configuration parameter is used then new files will be used in every execution of the plugin, they aren't timestamped like the file based WSDLs to avoid regeneration. Also you run the risk of breaking your build if the remote server is down and you can't get the WSDL file.

Production vs development

If your environment requires you to make use of development WSDLs in conjunction with production WSDLs then investigate the usage of profiles for conditionally executing this plugin based on your current execution environment.

Test cases

The wsdl2java goal can make use of the unit tests generated by the <testCases> parameter by setting <runTestCasesAsUnitTests> to true. This will move the test cases generated by wsdl2java into the test sources directory and add it to the project so it is picked up by Maven Surefire Plugin.

Note: Using this functionality, the external resource will need to be up otherwise the unit tests will fail. I am investigating the best way to moving this into an integration phase target.

Using a different Axis version

By default, the wsdl2java goal uses Axis 1.4. You may use another version of the library by setting dependencies in the plugin configuration:

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>axistools-maven-plugin</artifactId>
        <version>1.5-SNAPSHOT</version>
        <dependencies>
          <dependency>
            <groupId>axis</groupId>
            <artifactId>axis</artifactId>
            <version>1.2.1</version>
          </dependency>
        </dependencies>
      </plugin>

Mapping namespace to package

The configuration for this depends on whether you are using the emitter or not.

If you are not using the emitter, which is the default behavior, you must use <mappings>.

If you are using the emitter you can use either <mappings> or <namespaceToPackage>.

Configure <mappings>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>axistools-maven-plugin</artifactId>
        <version>1.5-SNAPSHOT</version>
        <configuration>
          [<useEmitter>true</useEmitter>]
          <mappings>
            <mapping>
              <namespace>http://ws.mycompany.com/axis/services/MyWebService</namespace>
              <targetPackage>com.mycompany.mywebservice</targetPackage>
            </mapping>
          </mappings>
        </configuration>
      </plugin>

Configure <namespaceToPackage>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>axistools-maven-plugin</artifactId>
        <version>1.5-SNAPSHOT</version>
        <configuration>
          <useEmitter>true</useEmitter>
          <namespaceToPackage>http://ws.mycompany.com/axis/services/MyWebService=com.mycompany.mywebservice</namespaceToPackage>
        </configuration>
      </plugin>

Note: The plugin only has support for one <namespaceToPackage> mapping. If you need more you'll have to use <mappings>.