0

My pom.xml is given below

i had build this example from here The generated folder is not getting created in target folder. I had tried each and every one of the instruction reported below, but the classes are not generating in target folder.

In this example we're running the wsdl2java goal in the generate-sources phase.

By running mvn generate-sources, CXF will generate artifacts in the directory that you specify. Each element corresponds to a WSDL that you're generated artifacts for. The WSDL location is specified via the <wsdl> option.

Following Maven standard directory layout, if you're planning on packaging the WSDL in the JAR you're creating you'll want the WSDL above in /src/main/resources/ (alternatively in a subfolder underneath it if desired to avoid placing resources in the root of a JAR); else use the /src/main/config folder to keep the WSDL out of the JAR.

<?xml version="1.0" encoding="UTF-8"?>
<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>org.apache.camel</groupId>
  <artifactId>camel-example-reportincident</artifactId>
  <version>1.0.0-SNAPSHOT</version>

  <name>Camel Web Application</name>
  <description>Camel project that deploys the Camel routes as a WAR</description>
  <url>http://www.myorganization.org</url>

  <packaging>war</packaging>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <cxf-version>2.7.0</cxf-version>
  </properties>

  <repositories>
    <repository>
      <id>release.fusesource.org</id>
      <name>FuseSource Release Repository</name>
      <url>http://repo1.maven.org/maven2</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <releases>
        <enabled>true</enabled>
      </releases>
    </repository>
    <repository>
     <id>ea.fusesource.org</id>
     <name>FuseSource Community Early Access Release Repository</name>
     <url>http://repo1.maven.org/maven2</url>
     <snapshots>
      <enabled>false</enabled>
     </snapshots>
     <releases>
      <enabled>true</enabled>
     </releases>
    </repository>    
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>release.fusesource.org</id>
      <name>FuseSource Release Repository</name>
      <url>http://repo1.maven.org/maven2</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <releases>
        <enabled>true</enabled>
      </releases>
    </pluginRepository>
    <pluginRepository>
     <id>ea.fusesource.org</id>
     <name>FuseSource Community Early Access Release Repository</name>
     <url>http://repo1.maven.org/maven2</url>
     <snapshots>
      <enabled>false</enabled>
     </snapshots>
     <releases>
      <enabled>true</enabled>
     </releases>
    </pluginRepository>      
  </pluginRepositories>

 <dependencies>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
            <version>2.15.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-stream</artifactId>
            <version>2.15.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-jms</artifactId>
            <version>2.15.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-camel</artifactId>
            <version>5.6.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>4.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-spring</artifactId>
            <version>2.15.1</version>
        </dependency>   
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-cxf</artifactId>
            <version>2.15.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http-jetty</artifactId>
            <version>3.0.4</version>
        </dependency>       
    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
    <scope>provided</scope>
</dependency>
    <dependency>
        <groupId>org.apache.axis</groupId>
        <artifactId>axis</artifactId>
        <version>1.4</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis</groupId>
        <artifactId>axis-jaxrpc</artifactId>
        <version>1.4</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis</groupId>
        <artifactId>axis-saaj</artifactId>
        <version>1.4</version>
    </dependency>
    <dependency>
    <groupId>axis</groupId>
    <artifactId>axis-wsdl4j</artifactId>
    <version>1.5.1</version>
</dependency>
<dependency>
    <groupId>commons-discovery</groupId>
    <artifactId>commons-discovery</artifactId>
    <version>0.4</version>
</dependency> 
<dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.14</version>
    </dependency>
    </dependencies>
    <build>

        <pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <version>7.0.0pre3</version>
        </plugin>
        <plugin>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-codegen-plugin</artifactId>
            <version>2.6.1</version>
            <executions>
                <execution>
                    <id>generate-sources</id>
                    <phase>generate-sources</phase>
                    <configuration>
                        <sourceRoot>${basedir}\target\generated\</sourceRoot>
                        <wsdlOptions>
                            <wsdlOption>
                                <wsdl>${basedir}\src\main\webapp\WEB-INF\wsdl\report_incident.wsdl</wsdl>
                            </wsdlOption>
                        </wsdlOptions>
                    </configuration>
                    <goals>
                        <goal>wsdl2java</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</pluginManagement>
    </build>

</project>
Yash
  • 41
  • 1
  • 4
  • I had build this example by refering to this [camel example](http://camel.apache.org/tutorial-example-reportincident-part1.html). – Yash Nov 19 '15 at 09:00

2 Answers2

0

In many of my projects I had the same requirement and usually I used a pom like this:

<plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-codegen-plugin</artifactId>
        <version>3.0.4</version>
        <executions>
            <execution>
                <id>generate-sources</id>
                <phase>generate-sources</phase>
                <configuration>
                    <wsdlOptions>
                        <wsdlOption>
                            <wsdl>${basedir}/src/main/resources/wsdl/Authentication.wsdl</wsdl>
                            <wsdlLocation>classpath:wsdl/Authentication.wsdl</wsdlLocation>
                            <extraargs>
                                <extraarg>-client</extraarg>
                            </extraargs>
                        </wsdlOption>                               
                    </wsdlOptions>
                </configuration>
                <goals>
                    <goal>wsdl2java</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

and classes have been successfully created in the target folder.

I'm using version 3.0.4 but I'm sure this worked also with 2.x versions.

I think that you're missing the -client extraarg:

<extraargs>
    <extraarg>-client</extraarg>
</extraargs>

and, more important, you can omit the <sourceRoot> tag thus leaving the default value. More references in this post.

Community
  • 1
  • 1
abarisone
  • 3,707
  • 11
  • 35
  • 54
0

Try using forward slash (/) instead of backward slash (\) i.e.

<configuration>
           <sourceRoot>${basedir}/target/generated/cxf/</sourceRoot>
                        <wsdlOptions>
                            <wsdlOption>
                                <wsdl>${basedir}/src/main/webapp/WEB-INF/wsdl/report_incident.wsdl</wsdl>
                            </wsdlOption>
                        </wsdlOptions>
    </configuration>
Ankush soni
  • 1,439
  • 1
  • 15
  • 30