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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to