Question

I have a multi module Maven project that has a 'database' module that tears down/sets up the database needed for integration testing on all subsequent modules. Because it is a script rather than Java module Maven can't resolve any dependencies and so it always seems to get executed last.

Is there an option to override the execution order in the parent POM?

Was it helpful?

Solution

OK maven apparently honors the order modules are specified in the parent, so this works nicely:

<modules>
    <module>database</module>
    <module>dao</module>
    <module>business</module>
    <module>web</module>
</modules>

OTHER TIPS

The best thing is to create a separate module like whatever-it and define dependencies to your appropriate modules which automatically defines the order of execution. This makes sure is will always run in the correct order. The order given in the modules is not guaranteed. So better use dependencies.

Check this post on how maven does ordering of modules. If your build is not following the order of modules it should be due to one of the reasons in the post.

http://maven.apache.org/guides/mini/guide-multiple-modules.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top