dev@glassfish.java.net

Re: module directory name in maven output

From: Jane Young <Jane.Young_at_Sun.COM>
Date: Wed, 17 Mar 2010 17:56:06 -0700

Another option is add a plugin goal called "echo" in the existing
maven-glassfishbuild-plugin.
The maven-glassishbuild-plugin is built in v3/build module. We can add
an EchoMojo.java in this module.

In the pom, configure the plugin as:

Index: pom.xml
===================================================================
--- pom.xml (revision 36007)
+++ pom.xml (working copy)
@@ -184,6 +184,23 @@
                       </execution>
                    </executions>
             </plugin>
+ <plugin>
+ <groupId>org.glassfish.build</groupId>
+ <artifactId>maven-glassfishbuild-plugin</artifactId>
+ <version>3.1-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>echo</id>
+ <phase>install</phase>
+ <goals>
+ <goal>echo</goal>
+ </goals>
+ <configuration>
+ <message>Building in
${project.basedir}</message>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
         </plugins>
     </build>

Note that the goal is executed in the "install" phase. You can change
to or add another Maven lifecycle phase or even add more messages.
The output will look like this:

[INFO] [gf:echo {execution: echo}]
[INFO]
------------------------------------------------------------------------
[INFO] Building in /export/GlassFish/Mar16/v3/admin/cli
[INFO]
------------------------------------------------------------------------
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 11 seconds
[INFO] Finished at: Wed Mar 17 17:45:35 PDT 2010
[INFO] Final Memory: 53M/106M
[INFO]
------------------------------------------------------------------------

You can add the plugin in the top level pom so that this output gets
displayed in all the submodule builds.

I have the EchoMojo.java in my local workspace. If you like this, I'll
commit it in the v3 trunk.

Thanks,
Jane



Tim Quinn wrote:
>
> On Mar 17, 2010, at 3:52 PM, Bill Shannon wrote:
>
>> Well, that does get the information out there, but it's pretty well
>> obscured in the maven chit-chat. Seems like a kludge to have to resort
>> to ant to do this too. :-) But, it's better than not having the
>> information at all.
> I agree on all counts!
>
> The <echo> could, of course, use multiple lines and rows of stars or
> something like that so the build directory message would stand out
> better, but that might be only marginally better.
>
> I disliked this approach less than I disliked the mangled module name
> one because (1) the name stays clean, and (2) it requires a single set
> of changes in the global pom which then takes effect for all other
> modules, rather than involving individual changes in each of the many
> module-level poms.
>
> Ideally there would be an easy way to add to the initial
>
> "Building ${moduleName}"
>
> message about what's being built, but I have no idea whether that
> comes from yet another plug-in or whether that's more hard-wired in
> somewhere.
>
> Another possibility: add our own plug-in or modify one we've already
> built to output just the build directory. The enforcer plug-in, for
> example, runs very early and emits a single line after the
> "Building..." message. Maybe that means that plug-ins can emit a
> single line while invoking ant creates much more noise??
>
> - Tim
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>