2

I am trying to generate sources from wsdl

This is my plug-in.

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.9</version>
            <executions>
                <execution>
                    <id>add-source</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>add-source</goal>
                    </goals>
                    <configuration>
                        <sources>
                            <source>${basedir}/target/generated-sources/wsdl</source>
                        </sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <version>1.12</version>
            <executions>
                <execution>
                    <id>gen1</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>wsimport</goal>
                    </goals>
                    <configuration>
                        <packageName>pkg1</packageName>
                        <wsdlDirectory>${basedir}/src/main/resources/wsdl/xml1</wsdlDirectory>
                        <keep>true</keep>
                        <sourceDestDir>${basedir}/target/generated-sources/wsdl</sourceDestDir>
                    </configuration>
                </execution>
                <execution>
                    <id>gen2</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>wsimport</goal>
                    </goals>
                    <configuration>
                        <packageName>pkg2</packageName>
                        <wsdlDirectory>${basedir}/src/main/resources/wsdl/xml2</wsdlDirectory>
                        <keep>true</keep>
                        <sourceDestDir>${basedir}/target/generated-sources/wsdl</sourceDestDir>
                    </configuration>
                </execution>
            </executions>
        </plugin>

When I run mvn compile, only gen1 is generated. I want it to generate both executions. I cannot combine them as they are residing in different wsdl directories and require different packagenames.

I understand that I can split into profiles and run it like mvn compile -Pprofile1,profile2.

But is there an easier way?

william
  • 7,284
  • 19
  • 66
  • 106
  • It should already work like this. What happens if you cut down `gen1`? Does the other one execute? – Andrei Aug 24 '17 at 07:01
  • Also is it possible that executions already work but one output overrides the other? – Andrei Aug 24 '17 at 07:02
  • Yes, If I comment out gen1, gen2 works. I did not think of one output overriding the other. Let me try to put them in different sourceDestDir – william Aug 24 '17 at 13:32

0 Answers0