maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gabriele Columbro" <>
Subject Re: Limiting Plugin Inheritence
Date Mon, 01 Dec 2008 20:51:58 GMT
I solved this problem using profiles and working on the fact that a profile
is inherited only when it's defined also in the child pom, so not definying
your plugin/plugins configuration in the main build.

I have a project structure composed of multiple (WAR and JAR) artifacts with
cross dependencies and a super pom, something like:

                    |-- project_war1
                    |-- project_war2
                    |-- project_jar1

So basically I have a (for jboss using cargo) a super pom which defines all
cargo plugin configuration in a profile called 'deploy' , which goes
something like this:

            <!-- Profile to deploy to a local jboss instance, due to -->





Properties for this profile are configured in the superpom <properties>
section, which goes something like:

        <!-- src/main/properties/<env>/ is loaded for
all subproject -->

Then, for every project which I'd like to deploy I configure in the specific
child pom an <inherited> profile with same id ("deploy" in our case) as this
one which actually binds the specified plugin configuration to an actual
lifecycle phase (typically in the pre-integration-test):

                                    <!-- This works as expected -->

So basically running my build from the super pom by explicitly activating
the plugin (because according to [1] inherited profiles only gets run  if
explicitly called by id with -P option and not with the other activation
methods described here [2] ):

mvn clean install -P deploy

I get only the selected sub projects to be deployed with cargo while other
projects (that do not inherit the profile) will only run the default build
lifecycle (so with neither cargo configuaration nor binding it to a phase).

As a side note, I also use "environmental" profiles (using the <env>
variable) so that different cargo (buildtime) properties and and application
(runtime) properties are selected, e.g. :




which allows me to have my selected subprojects deployed to different
environment by combining profiles in a quite short command line (considering
maven standards :) :

mvn clean install -Pdeploy,accpt

Hope a lot this helps! And hopefully someone can come with some even easier
and shorter way to express this non trivial requirement.



2008/12/1 euqaz <>

> I'm trying to port a project over to Maven.   We've been developing an
> enterprise application in eclipse and have the following projects:
> projectname-beans  (all session beans and dependent classes)
> projectname-entities (all jpa entities)
> projectname-lib (all remote interfaces and dto objects)
> projectname-client-api (the api that clients program against using dto)
> projectname-core (the ear definition)
> projectname-parent (the maven parent project)
> currently I have just about everything working (i think).  i can build,
> test, and package just fine.  i can even deploy the ear to glassfish using
> the glassfish plugin but this is where i'm trying to make some improvements
> to the build and coming up short...
> directory structure:
> projectname-parent/
>   projectname-beans/
>   projectname-entities/
>   projectname-lib/
>   projectname-client-api/
>   projectname-core/
> beans, entities, lib, client-api, core are all <modules> or parent.
> I'm trying to define the glassfish plugin in the parent pom and be able to
> run: projectname-parent> mvn glassfish:deploy
> and have it deploy the projectname-core.ear
> after succesfully deploying the ear it then tries to run the
> glassfish:deploy goal on each module (client-lib, api, beans, entites)
> which
> fails.  (well, actually deploy doesn't fail - it doesn't do anything...but
> glassfish:undeploy does fail.  in reality, the main problem is that
> glassfish plugin is running against all modules)
> how can I define a plugin in the parent that does not run against each
> child
> module?
> snip of parent pom:
> <!-- parent pom snippet -->
> <project>
> ...
>        <build>
>           <plugins>
>              <plugin>
>                 <groupId>org.glassfish.maven.plugin</groupId>
>                 <artifactId>maven-glassfish-plugin</artifactId>
>                 <version>2.1</version>
>                 <configuration>
>  <glassfishDirectory>${glassfish.home}</glassfishDirectory>
>                    <domainDirectory>${dev.domain.dir}</domainDirectory>
>                    <autoCreate>false</autoCreate>
>                    <echo>false</echo>
>                    <terse>false</terse>
>                    <interactive>false</interactive>
>                    <user>admin</user>
> <passwordFile>${dev.domain.dir}/${
> }/dev-domain-pw-file</passwordFile>
>                    <domain>
>                       <name>${}</name>
>                       <adminPort>4848</adminPort>
>                       <httpPort>8080</httpPort>
>                       <httpsPort>8443</httpsPort>
>                       <iiopPort>3700</iiopPort>
>                       <jmsPort>7676</jmsPort>
>                    </domain>
>                    <components>
>                       <component>
>                          <name>${}</name>
> <artifact>${}/${}/${
>                       </component>
>                    </components>
>                 </configuration>
>              </plugin>
>           </plugins>
>   </build>
> ...
> </project>
> --
> View this message in context:
> Sent from the Maven - Users mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Gabriele Columbro
Alfresco ECM Product Strategy Consultant
+31 627 565 103
Sourcesense - Making sense of open Source (

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message