Announcement Announcement Module
Collapse
No announcement yet.
maven 2 generics issue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • maven 2 generics issue

    I get this errors
    Compiling 6 source files to /root/workspace/tekframework/target/classes
    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Compilation failure

    /root/workspace/tekframework/src/main/java/com/tek/common/persist/user/UserSpringDAO.java:[25,18] generics are not supported in -source 1.3
    (try -source 1.5 to enable generics)
    final List<User> users = new ArrayList<User>();

    /root/workspace/tekframework/src/main/java/com/tek/common/persist/user/UserDAO.java:[8,8] generics are not supported in -source 1.3
    (try -source 1.5 to enable generics)
    List<User> getUsers();

    /root/workspace/tekframework/src/main/java/com/tek/common/util/I18NUtil.java:[23,30] generics are not supported in -source 1.3
    (try -source 1.5 to enable generics)
    private static ThreadLocal<Locale> currentLocale = new ThreadLocal<Locale>();

    /root/workspace/tekframework/src/main/java/com/tek/common/util/I18NUtil.java:[127,62] variable-arity methods are not supported in -source 1.3
    (try -source 1.5 to enable variable-arity methods)
    public static String getMessage(String messageKey, Object ... params) {

    /root/workspace/tekframework/src/main/java/com/tek/common/util/I18NUtil.java:[205,51] for-each loops are not supported in -source 1.3
    (try -source 1.5 to enable for-each loops)
    for (String resourceBundleBaseName : resouceBundleBaseNames)

    /root/workspace/tekframework/src/main/java/com/tek/common/persist/user/UserHibDAO.java:[32,15] generics are not supported in -source 1.3
    (try -source 1.5 to enable generics)
    public List<User> getUsers() {


    when I run
    >mvn clean compile

    Please let me know if I am missing anything

  • #2
    Something like this in your parent pom:

    <build>
    <pluginManagement>
    <plugins>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <!-- best lock down version of the plugin too -->
    <configuration>
    <source>1.5</source>
    <target>1.5</target>
    </configuration>
    </plugin>

    Comment


    • #3
      thanks ge0ffrey,
      I got this resolved.

      Comment


      • #4
        Re: maven 2 generics issue

        --
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <!-- best lock down version of the plugin too -->
        <configuration>
        <source>1.5</source>
        <target>1.5</target>
        </configuration>
        </plugin>
        --

        I have this entry in my parent pom. but it still gives me the same exception when I compile.

        Any help would greatl be appreciated.

        Thanks
        Samanth

        Comment


        • #5
          post your entire pom.xml and the exception you are getting.

          Comment


          • #6
            Thanx. I got this resolved by having this plugin entry in all other related pom files.

            Q: Is it not sufficient to have this entry in the POM file itself?

            Thanks
            Samanth

            Comment


            • #7
              Quick answer is no.
              You have child pom, which goes itself into the lifecycle of compile.

              Comment


              • #8
                Originally posted by samanthb View Post
                --
                <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <!-- best lock down version of the plugin too -->
                <configuration>
                <source>1.5</source>
                <target>1.5</target>
                </configuration>
                </plugin>
                --

                I have this entry in my parent pom. but it still gives me the same exception when I compile.

                Any help would greatl be appreciated.

                Thanks
                Samanth
                Maybe you need to do a mvn install on the parent before doing the compile.

                Comment


                • #9
                  thanks for the reply jjjasper! I got this resolved long time back

                  Comment


                  • #10
                    Hi all,

                    I am also getting this problem. I've added plugin entry to my pom.xml but could not resolve it.

                    <build>

                    <plugins>
                    <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <executions>
                    <execution>
                    <id>java-1.5-compile</id>
                    <phase>process-test-sources</phase>
                    <goals>
                    <goal>testCompile</goal>
                    </goals>
                    <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                    </configuration>
                    </execution>
                    </executions>
                    </plugin>
                    </plugins>
                    <finalName>ROOT</finalName>
                    </build>

                    Kindly advice.
                    Thanks
                    Patricia.

                    Comment

                    Working...
                    X