You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by janne postilista <ja...@gmail.com> on 2010/08/05 09:50:02 UTC

Define profile plugin in root pom.xml, define execution in child pom.xml?

I have hierarchival build with parent root and some modules.

root
  - somejar
  - someejb
  - somewebapp

I want to define a profile which deploys my ejb and webapp to a server. This
profile has plugin maven-glassfish-plugin for the deployment. Plugin has a
lot of configuration so I would not like to repeat it. All my modules (eg.
somejar) do NOT want to use the plugin. Can I define the plugin
configuration in the  root pom.xml and define the execution in the module
pom.xmls?

Another problem is that part of the plugin configuration
(components-component-name/artifact) is different in different modules
(someejb.jar vs somewebapp.war for example). So I would need to define most
of the plugin confguration in the root pom.xml, and override some parts in
the module pom.xml....is this possible?

Example of the plugin configuration:

        <profile>
            <id>ci</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.glassfish.maven.plugin</groupId>
                        <artifactId>maven-glassfish-plugin</artifactId>
                        <version>2.1</version>
                        <configuration>

 <glassfishDirectory>${glassfish.home}</glassfishDirectory>
                            <user>${domain.username}</user>

 <adminPassword>${domain.password}</adminPassword>
                            <autoCreate>false</autoCreate>
                            <debug>true</debug>
                            <echo>true</echo>
                            <force>true</force>
                            <terse>true</terse>
                            <skip>${test.int.skip}</skip>
                            <domain>
                                <name>${domain.name}</name>
                                <adminPort>${domain.adminPort}</adminPort>
                                <httpPort>${domain.httpPort}</httpPort>
                                <httpsPort>${domain.httpsPort}</httpsPort>
                                <iiopPort>${domain.iiopPort}</iiopPort>
                                <jmsPort>${domain.jmsPort}</jmsPort>
                                <reuse>false</reuse>
                                <properties>
                                    <property>
                                        <name>server.log-service.file</name>

 <value>${domain.log.dir}/server.log</value>
                                    </property>
                                </properties>
                            </domain>
                            <components>
                                <component>
                                    <name>${project.artifactId}</name>

 <artifact>${project.build.directory}/${project.build.finalName}.jar</artifact>
                                </component>
                            </components>
                        </configuration>
                        <executions>
                            <execution>
                                <id>glassfish-undeploy</id>
                                <phase>compile</phase>
                                <goals>
                                    <goal>undeploy</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>glassfish-deploy</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>deploy</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

Re: Define profile plugin in root pom.xml, define execution in child pom.xml?

Posted by Anders Hammar <an...@hammar.net>.
Yes, this is possible. In your parent pom, you add a pluginManagement
section where you put the common configuration. Then you do the binding in
those projects where you want it. It is also possible to override some
configurations there should you need to.

/Anders

On Thu, Aug 5, 2010 at 09:50, janne postilista
<ja...@gmail.com>wrote:

> I have hierarchival build with parent root and some modules.
>
> root
>  - somejar
>  - someejb
>  - somewebapp
>
> I want to define a profile which deploys my ejb and webapp to a server.
> This
> profile has plugin maven-glassfish-plugin for the deployment. Plugin has a
> lot of configuration so I would not like to repeat it. All my modules (eg.
> somejar) do NOT want to use the plugin. Can I define the plugin
> configuration in the  root pom.xml and define the execution in the module
> pom.xmls?
>
> Another problem is that part of the plugin configuration
> (components-component-name/artifact) is different in different modules
> (someejb.jar vs somewebapp.war for example). So I would need to define most
> of the plugin confguration in the root pom.xml, and override some parts in
> the module pom.xml....is this possible?
>
> Example of the plugin configuration:
>
>        <profile>
>            <id>ci</id>
>            <build>
>                <plugins>
>                    <plugin>
>                        <groupId>org.glassfish.maven.plugin</groupId>
>                        <artifactId>maven-glassfish-plugin</artifactId>
>                        <version>2.1</version>
>                        <configuration>
>
>  <glassfishDirectory>${glassfish.home}</glassfishDirectory>
>                            <user>${domain.username}</user>
>
>  <adminPassword>${domain.password}</adminPassword>
>                            <autoCreate>false</autoCreate>
>                            <debug>true</debug>
>                            <echo>true</echo>
>                            <force>true</force>
>                            <terse>true</terse>
>                            <skip>${test.int.skip}</skip>
>                            <domain>
>                                <name>${domain.name}</name>
>                                <adminPort>${domain.adminPort}</adminPort>
>                                <httpPort>${domain.httpPort}</httpPort>
>                                <httpsPort>${domain.httpsPort}</httpsPort>
>                                <iiopPort>${domain.iiopPort}</iiopPort>
>                                <jmsPort>${domain.jmsPort}</jmsPort>
>                                <reuse>false</reuse>
>                                <properties>
>                                    <property>
>                                        <name>server.log-service.file</name>
>
>  <value>${domain.log.dir}/server.log</value>
>                                    </property>
>                                </properties>
>                            </domain>
>                            <components>
>                                <component>
>                                    <name>${project.artifactId}</name>
>
>
>  <artifact>${project.build.directory}/${project.build.finalName}.jar</artifact>
>                                </component>
>                            </components>
>                        </configuration>
>                        <executions>
>                            <execution>
>                                <id>glassfish-undeploy</id>
>                                <phase>compile</phase>
>                                <goals>
>                                    <goal>undeploy</goal>
>                                </goals>
>                            </execution>
>                            <execution>
>                                <id>glassfish-deploy</id>
>                                <phase>pre-integration-test</phase>
>                                <goals>
>                                    <goal>deploy</goal>
>                                </goals>
>                            </execution>
>                        </executions>
>                    </plugin>
>                </plugins>
>            </build>
>        </profile>
>