Results 1 to 4 of 4

Thread: Running "mvn compile" with java version specified.

  1. #1

    Default Running "mvn compile" with java version specified.

    Hi all.

    I was developing my app in RPC for a while and everything was running smoothly. Then, I run "mvn clean" command and now I'm getting following errors during compilation:

    Code:
    ...\ProductsXMLHandler.java:[14,13] generics are not supported in -source 1.4
    (use -source 5 or higher to enable generics)
            private List<Product> returnList = new ArrayList<Product>();
    There are at least 15 of them and they are all related to the fact, that I have been using features from JDK5. I don't now how is it possible, that those classes have been compiled before. Some of them have been transfered from another project, so maybe they were not compiled before and after removing "*.class" files during "clean" command this might cause those errors.

    Anyways, my question is:

    How can I run MVN specifying Java version or where in my POM file can I specify the same thing?

    Best regards.
    Łukasz Bachman

  2. #2
    Join Date
    Sep 2004
    Location
    Ghent, Belgium
    Posts
    224

    Default

    Łukasz ,

    take a look at the pom.xml from the tiger module. That module's pom.xml contains an entry to compile against 1.5.

    hope this helps,

    Peter

  3. #3
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    Have a look at the (sparse I agree) maven documentation. The compiler plugin is explained clearly and even has a sample which you can use right away.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  4. #4

    Default

    Yeep, You were right guys.
    For clarity:
    I've added the code listed bellow to my POM file inside "plugins" tag:

    Code:
    <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <source>1.5</source>
              <target>1.5</target>
            </configuration>
          </plugin>
    Works like a dream! :-)

    Cheers!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •