1

In <profile> we have <activation> which we can use to say whether we want to run that profile.

In my one <profile> section there are many different <execution> sections under <executions> tag. But I want to run only few <execution> sections out of all present under <executions>.

Do we have any option to make <execution> section parameter?

I want something like below:

<profile>
     <executions>
        <execution shouldExecute="${shouldExecute_1.true}">
            </execution>
            <execution shouldExecute="${shouldExecute_2.true}">
            </execution>
    <executions>

Above is the dummy section describing maven's pom.xml

so if shouldExecute_1.true = true and shouldExecute_2.true = false then only first execution block will run.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Archana Mundaye
  • 523
  • 1
  • 5
  • 19
  • thats very odd, whats the use case? – Lokesh Oct 10 '13 at 16:15
  • In our pom.xml there are many execution tags and each tag builds/creates one database but we are not interested in creating all databases. So I just want to pass parameter to that execution so that I can run only one execution for the property I'm interested in. – Archana Mundaye Oct 10 '13 at 16:23
  • Or what's the other way because there are many profiles. Differernt profiles are used for different purposes. like one profiles copies all dbs from central location to local, for this there are different execution blocks for each db. Second profile contains different execution block for each db which runs all ddl/dml statements on that. How can I achieve this, do I have to separate out each execution block as one profile? If that the only option? – Archana Mundaye Oct 10 '13 at 16:27
  • To be frank i have never seen such a Paramterized pom. I would suggest just one execution tag which takes db name and details in form of properties from profiles. So this would mean that deployment to multiple DB would involve multiple builds but youl will be in control and things will be simple – Lokesh Oct 10 '13 at 16:30

1 Answers1

0

You may find a better answer here. As the original answer says, most plugins have a 'skip' parameter that you can use to override whether or not the execution runs.

<plugin>
  <groupId>com.foo.bar</groupId>
  <artifactId>plugin-name-here</artifactId>
  <executions>
    <execution>
      <id>theexecutiontoskip</id>
      <configuration>
        <skip>${controlling.property.here}</skip>
      </configuration>
    </execution>
  </executions>
</plugin>
EdwinW
  • 1,007
  • 2
  • 13
  • 32