1

I am defining a goal inside my pom.xml. There is a condition when I want the goal not to be executed. My pom.xml is:

 <plugins>
      <plugin>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
        <version>1.5.1</version>
        <executions>
          <execution>

            <goals>
              <goal>wsdl2code</goal>
            </goals>

            <configuration>
              <wsdlFile>src/main/resources/myWsdl.wsdl</wsdlFile>
              <databindingName>xmlbeans</databindingName>
             <unpackClasses>true</unpackClasses>
              <packageName>com.example.client</packageName>
              <flattenFiles>true</flattenFiles> 
              <outputDirectory>src/main/java</outputDirectory>
                <action>
                <ignore/>
            </action>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>

I tried using tag but it didnt work.

How can I make my pom.xml to skip this particular goal?

AppleBud
  • 1,501
  • 8
  • 31
  • 47
  • Have you thought about using profiles? – khmarbaise Jan 17 '14 at 10:46
  • No. I am trying this for the first time. So, unaware about certain things. Can you plz help me out with this? – AppleBud Jan 17 '14 at 10:48
  • BTW: What i missed. Why are defining the output directory to be the `src` folder which is usually under version control. Which does not make sense. Apart from that the tag `` and `` do not belong there. – khmarbaise Jan 17 '14 at 11:05

2 Answers2

0

(I can't comment yet so I'm posting this as an answer)

As khmarbaise said, you should try using profiles for this.

Take a look at a similar question here.

Community
  • 1
  • 1
ThomasC
  • 7,915
  • 2
  • 26
  • 26
0

You can use a profile like this:

<profiles>
    <profile>
        <id>my-profile</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.axis2</groupId>
                    <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
                    <version>1.5.1</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>wsdl2code</goal>
                            </goals>
                            <configuration>
                                <wsdlFile>src/main/resources/myWsdl.wsdl</wsdlFile>
                                <databindingName>xmlbeans</databindingName>
                                <unpackClasses>true</unpackClasses>
                                <packageName>com.example.client</packageName>
                                <flattenFiles>true</flattenFiles>
                                <outputDirectory>src/main/java</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

This can be activated in relationship with maven like this:

mvn -Pmy-profile clean package

If you don't specify the -Pmy-profile the execution of the plugin will not executed.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235