Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8401707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:52:33+00:00 2026-06-09T21:52:33+00:00

I have a big maven project divided to some modules. I decided to give

  • 0

I have a big maven project divided to some modules.

I decided to give the pmd (code quality check) module with maven.

when I try to test the pmd module using the command

mvn pmd:pmd

I get the following types of warnings:

  • Can’t use generics unless running in JDK 1.5 mode!
  • Can’t use annotations when running in JDK 1.4 mode!
  • Can’t use enum as a keyword in pre-JDK 1.5 target

looks like maven compiles the projects using jdk 1.4 for some reason.

java -version output:

java version "1.7.0_05"
OpenJDK Runtime Environment (IcedTea7 2.2.1) (Gentoo build 1.7.0_05-b21)
OpenJDK 64-Bit Server VM (build 23.0-b21, mixed mode)

I use gentoo linux.

Linux ufk-work 3.5.2-gentoo #1 SMP Sun Aug 19 18:58:32 IDT 2012 x86_64 Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz GenuineIntel GNU/Linux

mvn -version output:

Apache Maven 3.0.4 (r1232337; 2012-01-17 10:44:56+0200)
Maven home: /usr/share/maven-bin-3.0
Java version: 1.7.0_05, vendor: Oracle Corporation
Java home: /usr/lib64/icedtea7/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.5.2-gentoo", arch: "amd64", family: "unix"

so any ideas how to make sure that maven will compile for jdk 1.7 and not 1.4 ?

I googled and found usage examples of the maven-compiler-plugin as found in the following url: http://twit88.com/blog/2008/03/09/maven-compile-your-application-to-be-14-15-or-16-compatible/

unfortunately the results are exactly the same.

any information regarding the issue would be greatly appreciated.

thank you so much!

kfir

update

I tried adding the maven-compiler-plugin and the maven-pmd-plugin to my main pom.xml
but the results are exactly the same.

the updated pom.xml can view at http://bpaste.net/show/41166/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:52:34+00:00Added an answer on June 9, 2026 at 9:52 pm

    What you need is to tell the target version of PMD:

    <build>
      <pluginManagement>
        <plugins>
          <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-pmd-plugin</artifactId>
          <version>2.7.1</version>
          <configuration>
              <targetJdk>1.7</targetJdk>
              <rulesets>
                  <ruleset>tools/pmd-rules.xml</ruleset>
              </rulesets>
          </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    
        </plugins>
      </pluginManagement>
    </build>
    
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>2.7.1</version>
            </plugin>
        </plugins>
    </reporting>
    

    Note: A few month ago the 1.7 JDK was not supported, you should double check it in the documentation, otherwise you won’t be able to use the diamond syntax.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a big Maven project that uses the PMD plugin for code quality
I use eclipse and the maven plugin. I have a big multi-module project (~6
I have a big multi-module Maven project with thousands of tests. Each test loads
I have a big maven project with lots of modules. One of the modules
We are using maven with eclipse. We have a multi module project, quite big.
I have a big Maven multi-module build set up in my Jenkins. It is
I have a big project that uses maven and I'm creating the project's jar.
We currently have a big Maven 2 project that is rather a collection of
i have 3 maven project (starto.commons,starto.hibernate,starto.server) that use some same dependencies and two of
i have big decision tree with many Yes/No questions. i need implement some code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.