You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by el...@jpmchase.com on 2008/07/30 17:39:46 UTC

PMD/CPD Maven 2 Plugin Question

I am trying to integrate the pmd/cpd maven 2 plugin into our project. 

Pmd/cpd information is located here: http://pmd.sourceforge.net/cpd.html
Pmd/cpd maven 2 plugin information is located here: 
http://maven.apache.org/plugins/maven-pmd-plugin/index.html . This plugin 
will allow us to generate the pmd/cpd report.

I want to be able to run the cpd tool everytime we run mvn clean package.

In the main pom.xml, I have:

<build>
    <pluginManagement>
      <plugins> 
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-pmd-plugin</artifactId>
          <configuration>
                <linkXref>false</linkXref>
                <targetJdk>1.5</targetJdk>
                <aggregate>true</aggregate>
                <ignoreLiterals>true</ignoreLiterals>
                <ignoreIdentifiers>true</ignoreIdentifiers>
            </configuration>
          <executions>
                <execution>
                          <phase>package</phase>
                          <goals>
                                <goal>cpd</goal>
                          </goals>
                </execution>
          </executions>
         </plugin>



However, when I went ahead and run mvn package, it does not generate the 
report. 
I can generate the report if I run: mvn package pmd:cpd with the 
configuration values, but I would like to integrate it so that everytime I 
run mvn package, it will generate the report.

Any help/pointers will be appreciated.

Thanks,

Elliot Ng

-----------------------------------------
This communication is for informational purposes only. It is not
intended as an offer or solicitation for the purchase or sale of
any financial instrument or as an official confirmation of any
transaction. All market prices, data and other information are not
warranted as to completeness or accuracy and are subject to change
without notice. Any comments or statements made herein do not
necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.

Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to UK legal entities.

Re: PMD/CPD Maven 2 Plugin Question

Posted by Stephen Connolly <st...@gmail.com>.
The pluginManagement is a section where you define the default configuration
for any child projects if they decide to use the plugin, or if you invoke
the plugin directly (i.e. outside of the lifecycle)

The plugins section in the build defines the plugin configuration for that
project and can override the settings in pluginManagement

On Thu, Jul 31, 2008 at 7:38 AM, Carlos Alonso <ca...@unkasoft.com> wrote:

> Hi Elliot.
>
> At this point I'm not able to explain you exactly what the pluginManagement
> do, but I think that section is like a summary of what plugins you're using
> and that is more suitable in a parent pom. Then, in children poms or in a
> section below the one you're showing should be declared the plugin directly
> into the build section, but not below a pluginManagement one. Do you
> understand?
>
> So the easiest solution is to remove the pluginManagement tags. Also, I've
> to point that the configuration tags are more suitable within the execution
> tag itself. Showing that the specified configuration is associated to the
> specified execution.
>
> Finally, your code snippet should become like this:
>
> <build>
>        .
>        .
>        .
>     <plugins>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-pmd-plugin</artifactId>
>         <executions>
>               <execution>
>                         <phase>package</phase>
>                         <goals>
>                               <goal>cpd</goal>
>                         </goals>
>
>                        <configuration>
>                        <linkXref>false</linkXref>
>                        <targetJdk>1.5</targetJdk>
>                        <aggregate>true</aggregate>
>                        <ignoreLiterals>true</ignoreLiterals>
>                        <ignoreIdentifiers>true</ignoreIdentifiers>
>                        </configuration>
>               </execution>
>         </executions>
>        </plugin>
>        .
>        .
>        .
>        </plugins>
> </build>
>
>
>
>
> Hope it helps.
> Carlos
>
>
> elliot.t.ng@jpmchase.com escribió:
>
>  I am trying to integrate the pmd/cpd maven 2 plugin into our project.
>> Pmd/cpd information is located here: http://pmd.sourceforge.net/cpd.html
>> Pmd/cpd maven 2 plugin information is located here:
>> http://maven.apache.org/plugins/maven-pmd-plugin/index.html . This plugin
>> will allow us to generate the pmd/cpd report.
>>
>> I want to be able to run the cpd tool everytime we run mvn clean package.
>>
>> In the main pom.xml, I have:
>>
>> <build>
>>    <pluginManagement>
>>      <plugins>        <plugin>
>>          <groupId>org.apache.maven.plugins</groupId>
>>          <artifactId>maven-pmd-plugin</artifactId>
>>          <configuration>
>>                <linkXref>false</linkXref>
>>                <targetJdk>1.5</targetJdk>
>>                <aggregate>true</aggregate>
>>                <ignoreLiterals>true</ignoreLiterals>
>>                <ignoreIdentifiers>true</ignoreIdentifiers>
>>            </configuration>
>>          <executions>
>>                <execution>
>>                          <phase>package</phase>
>>                          <goals>
>>                                <goal>cpd</goal>
>>                          </goals>
>>                </execution>
>>          </executions>
>>         </plugin>
>>
>>
>>
>> However, when I went ahead and run mvn package, it does not generate the
>> report. I can generate the report if I run: mvn package pmd:cpd with the
>> configuration values, but I would like to integrate it so that everytime I
>> run mvn package, it will generate the report.
>>
>> Any help/pointers will be appreciated.
>>
>> Thanks,
>>
>> Elliot Ng
>>
>> -----------------------------------------
>> This communication is for informational purposes only. It is not
>> intended as an offer or solicitation for the purchase or sale of
>> any financial instrument or as an official confirmation of any
>> transaction. All market prices, data and other information are not
>> warranted as to completeness or accuracy and are subject to change
>> without notice. Any comments or statements made herein do not
>> necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
>> and affiliates.
>>
>> This transmission may contain information that is privileged,
>> confidential, legally privileged, and/or exempt from disclosure
>> under applicable law. If you are not the intended recipient, you
>> are hereby notified that any disclosure, copying, distribution, or
>> use of the information contained herein (including any reliance
>> thereon) is STRICTLY PROHIBITED. Although this transmission and any
>> attachments are believed to be free of any virus or other defect
>> that might affect any computer system into which it is received and
>> opened, it is the responsibility of the recipient to ensure that it
>> is virus free and no responsibility is accepted by JPMorgan Chase &
>> Co., its subsidiaries and affiliates, as applicable, for any loss
>> or damage arising in any way from its use. If you received this
>> transmission in error, please immediately contact the sender and
>> destroy the material in its entirety, whether in electronic or hard
>> copy format. Thank you.
>>
>> Please refer to http://www.jpmorgan.com/pages/disclosures for
>> disclosures relating to UK legal entities.
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: PMD/CPD Maven 2 Plugin Question

Posted by Carlos Alonso <ca...@unkasoft.com>.
Hi Elliot.

At this point I'm not able to explain you exactly what the 
pluginManagement do, but I think that section is like a summary of what 
plugins you're using and that is more suitable in a parent pom. Then, in 
children poms or in a section below the one you're showing should be 
declared the plugin directly into the build section, but not below a 
pluginManagement one. Do you understand?

So the easiest solution is to remove the pluginManagement tags. Also, 
I've to point that the configuration tags are more suitable within the 
execution tag itself. Showing that the specified configuration is 
associated to the specified execution.

Finally, your code snippet should become like this:

<build>
	.
	.
	.
      <plugins> 
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-pmd-plugin</artifactId>
          <executions>
                <execution>
                          <phase>package</phase>
                          <goals>
                                <goal>cpd</goal>
                          </goals>
		
          		<configuration>
                		<linkXref>false</linkXref>
                		<targetJdk>1.5</targetJdk>
                		<aggregate>true</aggregate>
                		<ignoreLiterals>true</ignoreLiterals>
                		<ignoreIdentifiers>true</ignoreIdentifiers>
            		</configuration>
                </execution>
          </executions>
         </plugin>
	.
	.
	.
	</plugins>
</build>




Hope it helps.
Carlos


elliot.t.ng@jpmchase.com escribió:
> I am trying to integrate the pmd/cpd maven 2 plugin into our project. 
>
> Pmd/cpd information is located here: http://pmd.sourceforge.net/cpd.html
> Pmd/cpd maven 2 plugin information is located here: 
> http://maven.apache.org/plugins/maven-pmd-plugin/index.html . This plugin 
> will allow us to generate the pmd/cpd report.
>
> I want to be able to run the cpd tool everytime we run mvn clean package.
>
> In the main pom.xml, I have:
>
> <build>
>     <pluginManagement>
>       <plugins> 
>         <plugin>
>           <groupId>org.apache.maven.plugins</groupId>
>           <artifactId>maven-pmd-plugin</artifactId>
>           <configuration>
>                 <linkXref>false</linkXref>
>                 <targetJdk>1.5</targetJdk>
>                 <aggregate>true</aggregate>
>                 <ignoreLiterals>true</ignoreLiterals>
>                 <ignoreIdentifiers>true</ignoreIdentifiers>
>             </configuration>
>           <executions>
>                 <execution>
>                           <phase>package</phase>
>                           <goals>
>                                 <goal>cpd</goal>
>                           </goals>
>                 </execution>
>           </executions>
>          </plugin>
>
>
>
> However, when I went ahead and run mvn package, it does not generate the 
> report. 
> I can generate the report if I run: mvn package pmd:cpd with the 
> configuration values, but I would like to integrate it so that everytime I 
> run mvn package, it will generate the report.
>
> Any help/pointers will be appreciated.
>
> Thanks,
>
> Elliot Ng
>
> -----------------------------------------
> This communication is for informational purposes only. It is not
> intended as an offer or solicitation for the purchase or sale of
> any financial instrument or as an official confirmation of any
> transaction. All market prices, data and other information are not
> warranted as to completeness or accuracy and are subject to change
> without notice. Any comments or statements made herein do not
> necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
> and affiliates.
>
> This transmission may contain information that is privileged,
> confidential, legally privileged, and/or exempt from disclosure
> under applicable law. If you are not the intended recipient, you
> are hereby notified that any disclosure, copying, distribution, or
> use of the information contained herein (including any reliance
> thereon) is STRICTLY PROHIBITED. Although this transmission and any
> attachments are believed to be free of any virus or other defect
> that might affect any computer system into which it is received and
> opened, it is the responsibility of the recipient to ensure that it
> is virus free and no responsibility is accepted by JPMorgan Chase &
> Co., its subsidiaries and affiliates, as applicable, for any loss
> or damage arising in any way from its use. If you received this
> transmission in error, please immediately contact the sender and
> destroy the material in its entirety, whether in electronic or hard
> copy format. Thank you.
>
> Please refer to http://www.jpmorgan.com/pages/disclosures for
> disclosures relating to UK legal entities.
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org