2

I have created a web project using maven 2(it will be deployed on tomcat 7.0.35), which should serve as a client for JAX-WS web service. I am trying to generate client classes from wsdl file(I have 1 wsdl and 1 xsd). After I run "mvn clean install" command, no classes are generated and I don't see any errors in console

This is my pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.test.ws</groupId>
  <artifactId>my_ws</artifactId>
  <packaging>war</packaging>
  <version>1.0</version>
  <name>cs Maven Webapp</name>
  <url>http://maven.apache.org</url>

  <build>
    <finalName>my_ws</finalName>
    <pluginManagement>
        <plugins>
         <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.8</version>
                <configuration>
                    <projectNameTemplate>
                        [artifactId]-[version]
                    </projectNameTemplate>
                    <wtpmanifest>true</wtpmanifest>
                    <wtpapplicationxml>true</wtpapplicationxml>
                    <wtpversion>2.0</wtpversion>
                    <manifest>
                        ${basedir}/src/main/resources/META-INF/MANIFEST.MF
                    </manifest>
                </configuration>
            </plugin>   
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                        <configuration>
                            <wsdlDirectory>${basedir}/src/main/resources/wsdl</wsdlDirectory>
                            <wsdlFiles>
                                <wsdlFile>my_ws.wsdl</wsdlFile>
                            </wsdlFiles>
                            <packageName>com.test.ws.client</packageName>
                            <sourceDestDir>${basedir}/target/generated-sources/</sourceDestDir>
                            <keep>true</keep>
                            <bindingFiles>
                                <bindingFile>${basedir}/src/main/resources/wsdl/binding.xml</bindingFile>
                                <bindingFile>${basedir}/src/main/resources/wsdl/jaxb-binding.xml</bindingFile>
                            </bindingFiles>
                        </configuration>
                        <phase>generate-sources</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </pluginManagement>
  </build>


  <dependencies>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.9</version>
    </dependency>
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc</artifactId>
        <version>11.2.0.2.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-rt</artifactId>
        <version>2.2.8</version>
    </dependency>
  </dependencies>

</project>

Here is binding.xml

<bindings
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    wsdlLocation="./my_ws.wsdl"
    xmlns="http://java.sun.com/xml/ns/jaxws">
        <!-- Disable default wrapper style -->
        <enableWrapperStyle>false</enableWrapperStyle>

</bindings>

and jaxb-binding.xml

<jaxb:bindings version="2.1" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <jaxb:globalBindings generateElementProperty="false" />
</jaxb:bindings> 
4

1 回答 1

3

在 pom 文件中使用 <pluginManagement> 元素时,您不会声明插件的使用情况,而是声明插件的可用性。<pluginManagement> 在父 pom 中用于通知子 pom 使用的可用插件。

只需删除此元素,即可调用插件。

于 2013-07-16T12:04:33.337 回答