Announcement Announcement Module
Collapse
No announcement yet.
Running "mvn compile" with java version specified. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Ł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

    Comment


    • #3
      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.

      Comment


      • #4
        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!

        Comment

        Working...
        X