You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Sasvata Chatterjee <sa...@gmail.com> on 2005/12/29 16:45:25 UTC

[m2] Multiproject (POM inheritance) plugin and properties questions

Hi,

I have read through several threads about related subjects, but I am still
not getting it.  Let me explain what I want to accomplish.

I want to have a top-level POM (packaging: pom), that defines several
plugins that will be applied to the sub-projects (not necessarily defined in
the same directory hierarchy). Simple, but there's always a but....

- The first issue:  I have defined the plugin configuration in the parent
POM, but the configuration needs to vary slightly by module.  I need to
provide a package naming variable (for example), that is different per
module, but not per user (hence, settings.xml is not appropriate), and need
to happen automatically in a multiproject build (hence, not suitable as a
command line param).  I saw a post where I could simply define the variable
in a <properties> element, nested right below the <project> element.  I
defined
<project>
   ...
   <properties>
       <namespace>myname</namesapce>
   </properties>
</project>

in each module's pom.xml, and in the plugin config in the parent pom, used
${namespace}.  Doesn't seem to get evaluated.  I tried ${
pom.properties.namespace} and that didn't work either (using m2 2.0.1).  As
an experiment, I tried to not use a parent POM, and define/use properties in
the same POM, and that didn't work either. What am I doing wrong?

- The second issue: I would like the module pom-s to be unaware of the
plugins being applied, and just control the behavior from the parent POM.  I
can define the plugins in the <project><build><plugin> section in the parent
POM, but the build fails because the plugins are applied to the parent
module also (which has no sources etc.).  I can put it in the
<project><build><pluginManagement><plugin> section, but now I have to define
the plugin in each module's POM, which is what I wanted to avoid in the
first place. Is there a solution for this?  I haven't yet, but as I
experiment more with profiles and activations, I think the repeated
configuration in each module's POM will likely grow, and I'd like to avoid
that.

Thanks in advance,
Shash