Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

maven2 inheritance & packaging

 
Kevin Kilbane
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Hope someone can help. I am new to maven2 and am having some problems with inheritance and packaging.

I have a parent project and a number of child projects. The child projects have different packaging values - jar, ear, war etc.

The parent project has a plugin org.apache.maven.plugins.maven-antrun-plugin that calls the 'run' goal during the test phase when a certain parameter is passed in to the mvn command at the command line.

I want all child projects to be able to pass this parameter in to the mvn command and trigger the plugin during the test phase.

This is where the problems arise - I have a child project that should produce a jar file when built:

1. I do not specify a packaging value for parentProjetc(defaults to jar) and deploy it. I set the child packaging to jar. I install the parentProject but when I try to build the child project I get the error:

org.apache.maven.reactor.MavenExecutionException: Parent: parentProject:jar:1.0 of project: childProject has wrong packaging: jar. Must be 'pom'. for project childProject

2. I set the parentProject packaging to pom and deploy it. I set the childProject packaging to jar and build it. No errors this time, the project's unit tests are run but the plugin is not run during the test phase. It does not seem to be inheriting the plugin.

3. I set the parentProject packaging to pom and deploy it. I set the childProject packaging to pom and build it. No errors, the plugin is triggered but the childProject's unit tests are not run.

I'm not sure if I am doing something wrong or my whole approach is wrong.

I want to be have the plugin in the parentProject, the childProject to inherit the plugin, the childProject to run it's unit tests and the childProject to produce a jar (or an ear or a war etc.).

I can post pom.xml entries if required.

Thanks in advance for any suggestions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic