Search code examples
junitsonarqubejax-wswsimport

Code Coverage and Sonar - SOAP generated code - importWS


Intro

Hi, I am using the following plugin in order to generate sources for a soap web-services.

        <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>jaxws-maven-plugin</artifactId>
                    <version>1.9</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>wsimport</goal>
                            </goals>
                            <phase>generate-sources</phase>
                        </execution>
                    </executions>
                    <configuration>
                        <wsdlUrls>                          <wsdlUrl>
http://interface/interface?wsdl
                            </wsdlUrl>
                        </wsdlUrls>
                        <sourceDestDir>${project.basedir}/src/main/java</sourceDestDir>
                    </configuration>
                </plugin>

I am generated the sources directly into the src folder.

Questions:

1) I am wondering whether the sources for the webservice should be generated in another folder? Would a different configuration work better?

2) How should I configure my project so that: JUnit, and Sonar to ignore these generated sources?


Solution

  • I ended up doing two things. The first is from the referenced link.

    First off, I changed the target directory for the code generation to instead be:

    <sourceDestDir>${project.basedir}/target/main/java</sourceDestDir>
    

    Finally, in inteliJ I right clicked the folder in target/main/java and clicked mark as directory as generated sources root:

    enter image description here

    References:

    https://stackoverflow.com/a/22913075/1688441