7

I need to do the following in the pre-integration-test phase:

  1. sql-maven-plugin:execute
  2. jetty-maven-plugin:deploy-war
  3. sql-maven-plugin:execute

Steps 1 and 3 have different configurations. I tried defining 1 and 3 as separate plugin elements, but I believe Maven just merges them into one plugin definition, resulting in an execution order of 1, 3, 2.

I need some way to execute these in the order defined above.

Jeremy Ross
  • 11,544
  • 3
  • 36
  • 36
  • I don't understand why you would want to do this. Can you not move step 3 into the integration-test phase? – Software Engineer Jun 16 '13 at 23:24
  • In step 2, the application runs database migrations. Only after this can I run 3, which loads test data to the database. – Jeremy Ross Jun 17 '13 at 00:43
  • So, have you tried moving the second sql plug-in into the integration-test phase? If it's the first plugin declared that's bound to that phase it'll be the first one to run. That should fix your problem. – Software Engineer Jun 17 '13 at 03:16
  • I'd considered this, but wanted to search for a better way that doesn't obscure the intention/integrity. Please add this as your answer so you can get some credit. – Jeremy Ross Jun 17 '13 at 03:54

1 Answers1

0

Short notice about maven build process:

  1. You can describe each plugin only once in pom.xml, duplicate descriptions is a bad practice (error prone).
  2. You can describe multiple separate executions for each plugin.
  3. Executions of the single plugin (bound to the single phase) will run in a sequence, regardless of other plugin definitions.
  4. Executions of the different plugins (bound to the single phase) will run in a sequence as they are described in pom.xml.

Thinking about this statements you have a simple way - bind (1) and (3) to different phases.

I suggest you to bind

  • (1) and (2) to 'pre-integration-test' phase, and
  • (3) to 'integration-test' phase

It will solve the sequence problem. See also full list of phases in maven docs to find proper phases for your case.

And you have an alternative way, if you run this scenario only from CI server. You can configure build job for explicit multiple-steps build via separate profiles in pom.xml:

  • build binaries
  • migrate scheme
  • deploy app
  • load test data

It is much more complex and error prone, so I prefer the first way.

ursa
  • 4,404
  • 1
  • 24
  • 38