3

I want to put the hibernate3-maven-plugin in my parent pom and have execution skipped in child modules if a given file does not exist in that module.

Is there any way to do this?

Up to now, I have had to do this:

<plugin>
   ...
   <configuration>
      <skip>true</skip>
      <propertyfile>target/test-classes/jdbc.properties</propertyfile>
   </configuration>
</plugin>

In the parent POM, and:

<plugin>
   ...
   <configuration>
      <skip>${maven.test.skip}</skip>
   </configuration>
</plugin>

In all child POMs where I want it to execute. I.E Those actually having a jdbc.properties file.

mysomic
  • 1,546
  • 3
  • 21
  • 34

2 Answers2

4

You may be able to do this with profiles, but I suppose you'd probably not want to run it in the parent project, which may be problematic.
Here are some links on profiles:

This question, had a similar issue and was not able to solve it with profiles:
activate-different-maven-profiles-depending-on-current-module

Community
  • 1
  • 1
crowne
  • 8,456
  • 3
  • 35
  • 50
1

I'm not 100% on the logistics but you could possibly use the maven exec plugin in combination with a shell script. The shell script would check for the presence of the file and then invoke the mvn plugin using the maven pom directory - which can be obtained and passed to the shell script via the Maven environment variables.

mmccomb
  • 13,516
  • 5
  • 39
  • 46