dev@glassfish.java.net

Re: module directory name in maven output

From: Tim Quinn <tim.quinn_at_oracle.com>
Date: Thu, 18 Mar 2010 10:59:55 -0500

In Jane's example the output is at the end because she tied the echo
goal to the "install" phase, which comes late. In my (poorer) example
with ant I tied the ant execution to the "initialize" phase so the
output appeared earlier. As Jane said we could choose whatever phase
we wanted - initialize seems best since it's the first one and I think
it runs regardless of what phase or phases are requested on the build.

The ideal, in my mind, would be to modify the current message that
says "Building ${moduleName}" so it displays not only the module name
but also the build directory, but as I mentioned earlier I have not
idea if that's easy or hard. If we cannot do that, I think Jane's
suggestion is a very good alternative.

- Tim

On Mar 17, 2010, at 8:58 PM, Bill Shannon wrote:

> Ok, that's interesting, but does the output come at the end of
> building
> a module or at the beginning? Ideally it should come as close to the
> output of the module name as possible. And it should come no matter
> what phase is being used. Whatever causes the output of the module
> name should also cause the output of the module directory.
>
>
> Jane Young wrote on 03/17/2010 05:56 PM:
>> 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
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>