2016-09-28 96 views
0

的pom.xml:無法生成從WSDL Java類在Eclipse

<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/xsd/maven-4.0.0.xsd"> 
     <modelVersion>4.0.0</modelVersion> 

     <groupId>com.ServiceTest</groupId> 
     <artifactId>SpericalClient</artifactId> 
     <version>0.0.1-SNAPSHOT</version> 
     <packaging>jar</packaging> 

     <name>SpericalClient</name> 
     <url>http://maven.apache.org</url> 

     <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <basedir> 
      E:\Radhika\Eclipse_Projects\SpericalClient 
     </basedir>  
     </properties> 


     <dependencies> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>3.8.1</version> 
      <scope>test</scope> 
     </dependency> 
     </dependencies> 

    <build> 
     <pluginManagement> 
       <plugins> 
        <plugin> 
         <groupId>org.jvnet.jaxb2.maven2</groupId> 
         <artifactId>maven-jaxb2-plugin</artifactId> 
         <version>0.13.1</version> 
         <executions> 
          <execution> 
           <goals> 
            <goal>generate</goal> 
           </goals> 
          </execution> 
         </executions> 
         <configuration> 
          <schemaLanguage>WSDL</schemaLanguage> 
          <generatePackage>com.ServiceTest.SpericalClient</generatePackage> 
          <schemas> 
           <schema> 
            <url>https://50.204.173.177:443/SphericallService</url> 
           </schema> 
          </schemas> 
         <configuration> 
          <packageName>com.ServiceTest.SpericalClient</packageName> 
          <wsdl>true</wsdl> 
          <xmlschema>false</xmlschema> 
          <schemaFiles>service.wsdl</schemaFiles> 
         </configuration> 
         </configuration> 
        </plugin> 
        <plugin> 
         <groupId>org.codehaus.mojo</groupId> 
         <artifactId>jaxws-maven-plugin</artifactId> 
         <version>1.12</version> 
         <configuration> 
          <wsdlDirectory>${basedir}/src/main/resources/wsdl</wsdlDirectory> 
          <packageName>com.raps.code.generate.ws</packageName> 
          <keep>true</keep> 
          <sourceDestDir>${basedir}/target/generated/src/main/java</sourceDestDir> 
         </configuration> 
         <executions> 
          <execution> 
           <goals> 
            <goal>wsimport</goal> 
           </goals> 
          </execution> 
         </executions> 
        </plugin> 
       </plugins> 
      </pluginManagement> 
    </build> 

    </project> 

當我嘗試生成的maven生成,classses班讓下面的輸出

[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building SpericalClient 0.0.1-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 0.121 s 
[INFO] Finished at: 2016-09-28T11:22:07+05:30 
[INFO] Final Memory: 5M/75M 
[INFO] ------------------------------------------------------------------------ 

文件夾結構: WSDL文件位於src-> main-> resources-> wsdl文件夾中 xsd文件位於src-> main-> resources->架構文件夾中

也包名是com.ServiceTest.Sp ericalClient

+0

插件執行綁定產生的目標,但不到特定的階段。你準確地運行了哪個maven命令? – Sammyrulez

回答

0

,因爲它是在pluginManagement

看看這裏只是宣稱你的插件將不會被執行:https://stackoverflow.com/a/10483284/1811730

您可以添加

<plugins> 
    <plugin> 
     <groupId>org.jvnet.jaxb2.maven2</groupId> 
     <artifactId>maven-jaxb2-plugin</artifactId> 
    </plugin> 
</plugins> 

到構建標籤一樣,

<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/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>com.ServiceTest</groupId> 
    <artifactId>SpericalClient</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <name>SpericalClient</name> 
    <url>http://maven.apache.org</url> 

    <properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <basedir> 
     E:\Radhika\Eclipse_Projects\SpericalClient 
    </basedir>  
    </properties> 


    <dependencies> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>3.8.1</version> 
     <scope>test</scope> 
    </dependency> 
    </dependencies> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.jvnet.jaxb2.maven2</groupId> 
      <artifactId>maven-jaxb2-plugin</artifactId> 
     </plugin> 
    </plugins> 

    <pluginManagement> 
      <plugins> 
       <plugin> 
        <groupId>org.jvnet.jaxb2.maven2</groupId> 
        <artifactId>maven-jaxb2-plugin</artifactId> 
        <version>0.13.1</version> 
        <executions> 
         <execution> 
          <goals> 
           <goal>generate</goal> 
          </goals> 
         </execution> 
        </executions> 
        <configuration> 
         <schemaLanguage>WSDL</schemaLanguage> 
         <generatePackage>com.ServiceTest.SpericalClient</generatePackage> 
         <schemas> 
          <schema> 
           <url>https://50.204.173.177:443/SphericallService</url> 
          </schema> 
         </schemas> 
        <configuration> 
         <packageName>com.ServiceTest.SpericalClient</packageName> 
         <wsdl>true</wsdl> 
         <xmlschema>false</xmlschema> 
         <schemaFiles>service.wsdl</schemaFiles> 
        </configuration> 
        </configuration> 
       </plugin> 
       <plugin> 
        <groupId>org.codehaus.mojo</groupId> 
        <artifactId>jaxws-maven-plugin</artifactId> 
        <version>1.12</version> 
        <configuration> 
         <wsdlDirectory>${basedir}/src/main/resources/wsdl</wsdlDirectory> 
         <packageName>com.raps.code.generate.ws</packageName> 
         <keep>true</keep> 
         <sourceDestDir>${basedir}/target/generated/src/main/java</sourceDestDir> 
        </configuration> 
        <executions> 
         <execution> 
          <goals> 
           <goal>wsimport</goal> 
          </goals> 
         </execution> 
        </executions> 
       </plugin> 
      </plugins> 
     </pluginManagement> 
</build> 

</project>