You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Geoffrey <jc...@hotmail.com> on 2005/11/03 09:45:38 UTC

[m2] pmd and java 1.5 site error: pmd doesn't know it's 1.5

I have a project with 1.5 java code. It has the following 
compile/reports configuration in the pom.xml:

     <build>
         <sourceDirectory>src</sourceDirectory>
         <resources>
             <resource>
                 <directory>src</directory>
                 <excludes>
                     <exclude>**/*.java</exclude>
                 </excludes>
             </resource>
         </resources>
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
                     <source>1.5</source>
                     <target>1.5</target>
                 </configuration>
             </plugin>
...
         </plugins>
     </build>
     <reporting>
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-pmd-plugin</artifactId>
             </plugin>
...
         </plugins>
     </reporting>


When I run "mvn site" I get:


[ERROR] VM #displayTree: error : too few arguments to macro. Wanted 2 got 0
[ERROR] VM #menuItem: error : too few arguments to macro. Wanted 1 got 0
[INFO] Generate "PMD Report" report.
[INFO] 
----------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] 
----------------------------------------------------------------------------
[INFO] Error during report generation

Embedded error: Failure executing PMD for: 
d:\projects\x1\x2\src\com\x3\x4\Hibernate\TestHiberna
te.java
Can't use JDK 1.5 for loop syntax when running in JDK 1.4 mode!


Apperently pmd doesn't check the compiler's source config.
I am probably using the follow version: 
~\.m2\repository\org\apache\maven\plugins\maven-pmd-plugin\2.0-alpha-2

-- 
With kind regards,
Geoffrey De Smet


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


Re: [m2] pmd and java 1.5 site error: pmd doesn't know it's 1.5

Posted by Brett Porter <br...@gmail.com>.
Plugins cannot share configuration at present (they can read it from
the pom manually, but that doesn't take into account defaults, etc).

This is a feature we will probably introduce for 2.1, but it needs to
be carefully considered - ie the compiler plugin needs to explicitly
declare what it is exporting, as a lot of the problems in m1 came from
plugins changing what they thought were internal properties and having
random plugins break.

Some information such as the language and source/target levels for
Java might be pushed up into the pom proper.

- Brett

On 11/4/05, Geoffrey <jc...@hotmail.com> wrote:
> Why isn't the targetJDK parameter of the pmd plugin defaulted to the
> source parameter of the compiler plugin, which is probably the case in
> Maven 1?
>
>
> I also noticed that the pmd-report resources aren't name spaced:
> They are in
> /src/resources/pmd-report.properties
> instead of
> /src/resources/org/apache/maven/plugin/pmd/pmd-report.properties
> Using the default namespace for resources is just as bad as using it for
> classes: if in any classpath 2 resource files end up having the same
> name, only one will be used. ClassLoaders might solve this partially,
> but it is very possible that the pmd.sf.net library, loaded in the same
> classloader, someday decides to have a pmd-report.properties file too.
>
> Edwin Punzalan wrote:
> > The compiler plugin parameter for JDK 1.5 is used for compiling sources.
> >
> > if you want PMD to know that it should 1.5, you should also tell it via
> > a configuration using targetJDK
> >
> >
> > Geoffrey wrote:
> >
> >> I have a project with 1.5 java code. It has the following
> >> compile/reports configuration in the pom.xml:
> >>
> >>     <build>
> >>         <sourceDirectory>src</sourceDirectory>
> >>         <resources>
> >>             <resource>
> >>                 <directory>src</directory>
> >>                 <excludes>
> >>                     <exclude>**/*.java</exclude>
> >>                 </excludes>
> >>             </resource>
> >>         </resources>
> >>         <plugins>
> >>             <plugin>
> >>                 <groupId>org.apache.maven.plugins</groupId>
> >>                 <artifactId>maven-compiler-plugin</artifactId>
> >>                 <configuration>
> >>                     <source>1.5</source>
> >>                     <target>1.5</target>
> >>                 </configuration>
> >>             </plugin>
> >> ...
> >>         </plugins>
> >>     </build>
> >>     <reporting>
> >>         <plugins>
> >>             <plugin>
> >>                 <groupId>org.apache.maven.plugins</groupId>
> >>                 <artifactId>maven-pmd-plugin</artifactId>
> >>             </plugin>
> >> ...
> >>         </plugins>
> >>     </reporting>
> >>
> >>
> >> When I run "mvn site" I get:
> >>
> >>
> >> [ERROR] VM #displayTree: error : too few arguments to macro. Wanted 2
> >> got 0
> >> [ERROR] VM #menuItem: error : too few arguments to macro. Wanted 1 got 0
> >> [INFO] Generate "PMD Report" report.
> >> [INFO]
> >> ----------------------------------------------------------------------------
> >>
> >> [ERROR] BUILD ERROR
> >> [INFO]
> >> ----------------------------------------------------------------------------
> >>
> >> [INFO] Error during report generation
> >>
> >> Embedded error: Failure executing PMD for:
> >> d:\projects\x1\x2\src\com\x3\x4\Hibernate\TestHiberna
> >> te.java
> >> Can't use JDK 1.5 for loop syntax when running in JDK 1.4 mode!
> >>
> >>
> >> Apperently pmd doesn't check the compiler's source config.
> >> I am probably using the follow version:
> >> ~\.m2\repository\org\apache\maven\plugins\maven-pmd-plugin\2.0-alpha-2
> >>
>
> --
> With kind regards,
> Geoffrey De Smet
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: [m2] pmd and java 1.5 site error: pmd doesn't know it's 1.5

Posted by Geoffrey <jc...@hotmail.com>.
Why isn't the targetJDK parameter of the pmd plugin defaulted to the 
source parameter of the compiler plugin, which is probably the case in 
Maven 1?


I also noticed that the pmd-report resources aren't name spaced:
They are in
/src/resources/pmd-report.properties
instead of
/src/resources/org/apache/maven/plugin/pmd/pmd-report.properties
Using the default namespace for resources is just as bad as using it for 
classes: if in any classpath 2 resource files end up having the same 
name, only one will be used. ClassLoaders might solve this partially, 
but it is very possible that the pmd.sf.net library, loaded in the same 
classloader, someday decides to have a pmd-report.properties file too.

Edwin Punzalan wrote:
> The compiler plugin parameter for JDK 1.5 is used for compiling sources.
> 
> if you want PMD to know that it should 1.5, you should also tell it via 
> a configuration using targetJDK
> 
> 
> Geoffrey wrote:
> 
>> I have a project with 1.5 java code. It has the following 
>> compile/reports configuration in the pom.xml:
>>
>>     <build>
>>         <sourceDirectory>src</sourceDirectory>
>>         <resources>
>>             <resource>
>>                 <directory>src</directory>
>>                 <excludes>
>>                     <exclude>**/*.java</exclude>
>>                 </excludes>
>>             </resource>
>>         </resources>
>>         <plugins>
>>             <plugin>
>>                 <groupId>org.apache.maven.plugins</groupId>
>>                 <artifactId>maven-compiler-plugin</artifactId>
>>                 <configuration>
>>                     <source>1.5</source>
>>                     <target>1.5</target>
>>                 </configuration>
>>             </plugin>
>> ...
>>         </plugins>
>>     </build>
>>     <reporting>
>>         <plugins>
>>             <plugin>
>>                 <groupId>org.apache.maven.plugins</groupId>
>>                 <artifactId>maven-pmd-plugin</artifactId>
>>             </plugin>
>> ...
>>         </plugins>
>>     </reporting>
>>
>>
>> When I run "mvn site" I get:
>>
>>
>> [ERROR] VM #displayTree: error : too few arguments to macro. Wanted 2 
>> got 0
>> [ERROR] VM #menuItem: error : too few arguments to macro. Wanted 1 got 0
>> [INFO] Generate "PMD Report" report.
>> [INFO] 
>> ---------------------------------------------------------------------------- 
>>
>> [ERROR] BUILD ERROR
>> [INFO] 
>> ---------------------------------------------------------------------------- 
>>
>> [INFO] Error during report generation
>>
>> Embedded error: Failure executing PMD for: 
>> d:\projects\x1\x2\src\com\x3\x4\Hibernate\TestHiberna
>> te.java
>> Can't use JDK 1.5 for loop syntax when running in JDK 1.4 mode!
>>
>>
>> Apperently pmd doesn't check the compiler's source config.
>> I am probably using the follow version: 
>> ~\.m2\repository\org\apache\maven\plugins\maven-pmd-plugin\2.0-alpha-2
>>

-- 
With kind regards,
Geoffrey De Smet


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


Re: [m2] pmd and java 1.5 site error: pmd doesn't know it's 1.5

Posted by Edwin Punzalan <ep...@exist.com>.
The compiler plugin parameter for JDK 1.5 is used for compiling sources.

if you want PMD to know that it should 1.5, you should also tell it via 
a configuration using targetJDK


Geoffrey wrote:

> I have a project with 1.5 java code. It has the following 
> compile/reports configuration in the pom.xml:
>
>     <build>
>         <sourceDirectory>src</sourceDirectory>
>         <resources>
>             <resource>
>                 <directory>src</directory>
>                 <excludes>
>                     <exclude>**/*.java</exclude>
>                 </excludes>
>             </resource>
>         </resources>
>         <plugins>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-compiler-plugin</artifactId>
>                 <configuration>
>                     <source>1.5</source>
>                     <target>1.5</target>
>                 </configuration>
>             </plugin>
> ...
>         </plugins>
>     </build>
>     <reporting>
>         <plugins>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-pmd-plugin</artifactId>
>             </plugin>
> ...
>         </plugins>
>     </reporting>
>
>
> When I run "mvn site" I get:
>
>
> [ERROR] VM #displayTree: error : too few arguments to macro. Wanted 2 
> got 0
> [ERROR] VM #menuItem: error : too few arguments to macro. Wanted 1 got 0
> [INFO] Generate "PMD Report" report.
> [INFO] 
> ---------------------------------------------------------------------------- 
>
> [ERROR] BUILD ERROR
> [INFO] 
> ---------------------------------------------------------------------------- 
>
> [INFO] Error during report generation
>
> Embedded error: Failure executing PMD for: 
> d:\projects\x1\x2\src\com\x3\x4\Hibernate\TestHiberna
> te.java
> Can't use JDK 1.5 for loop syntax when running in JDK 1.4 mode!
>
>
> Apperently pmd doesn't check the compiler's source config.
> I am probably using the follow version: 
> ~\.m2\repository\org\apache\maven\plugins\maven-pmd-plugin\2.0-alpha-2
>

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