Hi Brian,

Yes it works as it's the only way we can get plugin dependencies passed to
the reporting plugins, (see MNG-1948). Here's the profile we use, it started
off life doing nothing bar binding the plugins to the build but since then
we have added our own custom aggregation functionality and so they now run
goals.

The thing you want to make sure happens is that you see the plugins being
configured before the site phase of the build, then you should know that
they've been initialised as normal build plugins and should be available
when reporting comes to use them. 

Well that's how understand it :) This all started off life in 2.0.1 days,
core may have moved on such that simply binding them and not running any
mojos may no longer work ...

Hope it helps.

                <!-- 
============================================================= -->
                <!-- Default settings for plugins used in profiles or run from 
-->
                <!-- the command line -->
                <!-- 
============================================================= -->

                <pluginManagement>

                        <plugins>

                                <plugin>
                                        
<groupId>org.apache.maven.plugins</groupId>
                                        
<artifactId>maven-compiler-plugin</artifactId>
                                        <configuration>
                                                <source>1.5</source>
                                                <target>1.5</target>
                                        </configuration>
                                </plugin>

                                <plugin>
                                        
<groupId>org.apache.maven.plugins</groupId>
                                        
<artifactId>maven-clover-plugin</artifactId>
                                        <version>
                                                
${apt.maven-clover-plugin.version}
                                        </version>
                                        <dependencies>
                                                <dependency>
                                                        <groupId>
                                                                
com.fujitsu.fs.apt.maven.configs
                                                        </groupId>
                                                        
<artifactId>maven-apt-clover-config</artifactId>
                                                        <version>
                                                                
${apt.configs-clover.version}
                                                        </version>
                                                </dependency>
                                        </dependencies>
                                        <configuration>
                                                
<flushPolicy>threaded</flushPolicy>
                                                <jdk>1.5</jdk>
                                                
<flushInterval>100</flushInterval>
                                                
<targetPercentage>0%</targetPercentage>
                                                <licenseLocation>
                                                        clover-fujitsu.license
                                                </licenseLocation>
                                        </configuration>
                                </plugin>

                                <plugin>
                                        
<groupId>com.fujitsu.fs.apt.maven.plugins</groupId>
                                        
<artifactId>maven-apt-checkstyle-plugin</artifactId>
                                        <version>
                                                
${apt.maven-apt-checkstyle-plugin.version}
                                        </version>
                                        <dependencies>
                                                <dependency>
                                                        <groupId>
                                                                
com.fujitsu.fs.apt.maven.configs
                                                        </groupId>
                                                        <artifactId>
                                                                
maven-apt-coding-style-config
                                                        </artifactId>
                                                        <version>
                                                                
${apt.configs-coding-style.version}
                                                        </version>
                                                </dependency>
                                        </dependencies>
                                        <configuration>
                                                <configLocation>
                                                        
maven/maven-checkstyle-rules.xml
                                                </configLocation>
                                                <excludeDirs>
                                                        
<excludeDir>${basedir}/target/clover/src</excludeDir>
                                                </excludeDirs>
                                        </configuration>
                                </plugin>

                                <plugin>
                                        
<groupId>com.fujitsu.fs.apt.maven.plugins</groupId>
                                        
<artifactId>maven-apt-pmd-plugin</artifactId>
                                        
<version>${apt.maven-apt-pmd-plugin.version}</version>
                                        <dependencies>
                                                <dependency>
                                                        <groupId>
                                                                
com.fujitsu.fs.apt.maven.configs
                                                        </groupId>
                                                        <artifactId>
                                                                
maven-apt-coding-style-config
                                                        </artifactId>
                                                        <version>
                                                                
${apt.configs-coding-style.version}
                                                        </version>
                                                </dependency>
                                        </dependencies>
                                        <configuration>
                                                
<failurePriority>1</failurePriority>
                                                <rulesets>
                                                        
<ruleset>pmd/normal-pmd-rules.xml</ruleset>
                                                </rulesets>
                                                <excludeDirs>
                                                        
<excludeDir>${basedir}/target/clover/src</excludeDir>
                                                </excludeDirs>
                                        </configuration>
                                </plugin>

                                <plugin>
                                        
<groupId>org.apache.maven.plugins</groupId>
                                        
<artifactId>maven-eclipse-plugin</artifactId>
                                        
<version>${apt.maven-eclipse-plugin.version}</version>
                                        <configuration>
                                                
<projectNameTemplate>[artifactId]-[version]</projectNameTemplate>
                                                <wtpmanifest>true</wtpmanifest>
                                                
<wtpapplicationxml>true</wtpapplicationxml>
                                                <wtpversion>2.0</wtpversion>
                                        
<manifest>${project.build.directory}/generated-resources/eclipse/META-INF/MANIFEST.MF</manifest>
                                        </configuration>
                                </plugin>                       
                                
                        </plugins>

                </pluginManagement>



                <!-- 
============================================================= -->
                <!-- Site (aka bug workaround) profile -->
                <!-- 
============================================================= -->

                <profile>

                        <!-- this profile should only be activated during site 
generation,
                                it adds some plugins to the build phase that 
really shouldnt be
necessary but
                                are required due to bugs in Maven -->

                        <id>site</id>

                        <activation>
                                <property>
                                        <name>site</name>
                                        <value>true</value>
                                </property>
                        </activation>

                        <build>
                                <pluginManagement />

                                <plugins>

                                        <!-- These shouldnt have to be here at 
all, theyre only here to work
around a
                                                a bug in maven (two really). 
firstly report plugins cant have
<dependencies>
                                                set in the <reporting> section 
and second, reporting plugins wont
pickup 
                                                any configuration data from the 
pluginManagement section. However 
                                                a plugin is only ever 
initialised once in Maven (based upon it's
'identity') 
                                                and if a report pluing is put 
in into the main build lifecycle it gets
properly 
                                                initialised, including with 
dependencies however it wont do anything
as part 
                                                of the normal build, yet will 
run properly as part of 'site' -->

                                        <plugin>
                                                
<groupId>com.fujitsu.fs.apt.maven.plugins</groupId>
                                                
<artifactId>maven-apt-pmd-plugin</artifactId>
                                                <executions>
                                                        <execution>
                                                                
<id>data-aggregation</id>
                                                                
<phase>pre-site</phase>
                                                                <goals>
                                                                        
<goal>aggregate</goal>
                                                                </goals>
                                                        </execution>
                                                </executions>
                                        </plugin>                               
        

                                        <plugin>
                                                
<groupId>org.apache.maven.plugins</groupId>
                                                
<artifactId>maven-clover-plugin</artifactId>
                                                <executions>
                                                        <execution>
                                                                
<id>data-aggregation</id>
                                                                
<phase>pre-site</phase>
                                                                <goals>
                                                                        
<goal>aggregate</goal>
                                                                </goals>
                                                        </execution>
                                                </executions>
                                        </plugin>

                                        <plugin>
                                                
<groupId>com.fujitsu.fs.apt.maven.plugins</groupId>
                                                
<artifactId>maven-apt-checkstyle-plugin</artifactId>
                                                <executions>
                                                        <execution>
                                                                
<id>data-aggregation</id>
                                                                
<phase>pre-site</phase>
                                                                <goals>
                                                                        
<goal>aggregate</goal>
                                                                </goals>
                                                        </execution>
                                                </executions>
                                        </plugin>

                                </plugins>
                        </build>
                </profile>




Brian E Fox wrote:
> 
> Are you sure this works? I am 99% sure I tried this recently and had no
> luck.
> 
> -----Original Message-----
> From: jallen [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, January 05, 2008 11:41 AM
> To: [email protected]
> Subject: Re: buildManagement for reports
> 
> 
> Due to the way plugins are instantiated you can achieve what you wish
> doing
> the following:
> 
> Define the configurations of your reporting plugins via the standard
> <pluginsManagement> section of your parent POM (optional).
> 
> Then bind the reporting plugins to the build lifecycle of the children
> (i.e.
> in <build><plugins>). They will not run as they do not have a default
> phase,
> being designed to be run by site only. However Maven will instantiate
> them
> and will use the parent <pluginManagement> configs while doing so. When
> site
> is run Maven will re-use the already instantiated reporting plugins. 
> 
> To control when this build binding should be applied you can either put
> the
> plugins in a profile (and thus they only get defined in the parent) or
> bind
> them to pre-site, that way they'll only get instantiated when being used
> in
> site generation.
> 
> John
> 
> 
> dennisl-2 wrote:
>> 
>> simon wrote:
>>> Hi,
>>> 
>>> I would like to define some report configuration in a parent pom, so
>>> that they apply to child modules. In particular, the maven-pmd-plugin
>>> needs some config common to all the submodules. 
>>> 
>>> But I do not want those reports to actually *run* for the parent; it
>>> makes no sense to have a pmd report in the parent site's reports
>>> section, as the parent project has no code.
>>> 
>>> For a build plugin, this kind of configuration be done in the
>>> pluginManagement section. But configuring a report plugin in
>>> pluginManagement does not appear to affect reports, and there is no
>>> reportManagement section.
>>> 
>>> So what is the equivalent for report plugins?
>> 
>> Unfortunately there is no equivalent. But there is an issue for it if
>> you want to vote:
>> 
>> http://jira.codehaus.org/browse/MNG-1931
>> 
>>> Is it something to do with the reportSets section? I have read the
> maven
>>> docs on that several times and just don't understand what this is
> meant
>>> to do..
>> 
>> reportSets are used by plugins that output multiple reports. An
> example
>> of this is maven-changelog-plugin:
>> 
>>
> http://maven.apache.org/plugins/maven-changelog-plugin/examples/selectin
> g-reports.html
>> 
>>> 
>>> Thanks,
>>> 
>>> Simon
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>> 
>>> 
>> 
>> 
>> -- 
>> Dennis Lundberg
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/buildManagement-for-reports-tp14625165s177p1463551
> 6.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/buildManagement-for-reports-tp14625165s177p14648412.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to