You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Hari shankar <ha...@gmail.com> on 2010/07/04 12:33:35 UTC

Annotation @Override error - 'must override a superclass method' in eclipse

I started experimenting with maven and came across this err.

Since using @Override for a method in a class implementing interface is
applicable only in java 1.6, i have

a. setup java compliance level to 1.6 in eclipse
b. Pref -> Compilers -> Installed JREs to JDK 1.6
c. maven pom.xml in parent artifact has this config

<pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.1</version>
                    <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

The error occurs in one of child artifact ('domain' in this case) so i
checked it's effective POM and it correctly inherits the above config.
The beauty is am able to build all projects successfully from 'parent' but
the eclipse still reports compilation error on the annotated method.
So i suppose this is something to do with eclipse rather than maven but not
sure. What am i missing?

Though not required my maven project setup is this (a multi module)

parent
 |
 -- pom.xml
core
 |
 --pom.xml
domain
 |
 --pom.xml

 Thanks much for your time.

-Hari

Re: Annotation @Override error - 'must override a superclass method' in eclipse

Posted by Hari shankar <ha...@gmail.com>.
I got it resolved. Didn't notice the project specific setting that was
pointing to previous versions of JDK in compliance level (for 'domain'). Not
sure when i set it up. Got fooled by General Java -> Compiler setting that
said jdk 1.6.
Thanks.

On Sun, Jul 4, 2010 at 4:03 PM, Hari shankar <ha...@gmail.com> wrote:

> I started experimenting with maven and came across this err.
>
> Since using @Override for a method in a class implementing interface is
> applicable only in java 1.6, i have
>
> a. setup java compliance level to 1.6 in eclipse
> b. Pref -> Compilers -> Installed JREs to JDK 1.6
> c. maven pom.xml in parent artifact has this config
>
> <pluginManagement>
>             <plugins>
>                 <plugin>
>                     <groupId>org.apache.maven.plugins</groupId>
>                     <artifactId>maven-compiler-plugin</artifactId>
>                     <version>2.3.1</version>
>                     <configuration>
>                         <source>1.6</source>
>                         <target>1.6</target>
>                     </configuration>
>                 </plugin>
>             </plugins>
>         </pluginManagement>
>
> The error occurs in one of child artifact ('domain' in this case) so i
> checked it's effective POM and it correctly inherits the above config.
> The beauty is am able to build all projects successfully from 'parent' but
> the eclipse still reports compilation error on the annotated method.
> So i suppose this is something to do with eclipse rather than maven but not
> sure. What am i missing?
>
> Though not required my maven project setup is this (a multi module)
>
> parent
>  |
>  -- pom.xml
> core
>  |
>  --pom.xml
> domain
>  |
>  --pom.xml
>
>  Thanks much for your time.
>
> -Hari
>

Re: Annotation @Override error - 'must override a superclass method' in eclipse

Posted by Baptiste MATHUS <ml...@batmat.net>.
Hi,

Did you check your JDK is actually a 1.6 one?
In fact, maven might be well configured, but if the running JDK is not the
right one, it will trigger this kind of error.

Cheers

2010/7/4 Hari shankar <ha...@gmail.com>

> I started experimenting with maven and came across this err.
>
> Since using @Override for a method in a class implementing interface is
> applicable only in java 1.6, i have
>
> a. setup java compliance level to 1.6 in eclipse
> b. Pref -> Compilers -> Installed JREs to JDK 1.6
> c. maven pom.xml in parent artifact has this config
>
> <pluginManagement>
>            <plugins>
>                <plugin>
>                    <groupId>org.apache.maven.plugins</groupId>
>                    <artifactId>maven-compiler-plugin</artifactId>
>                    <version>2.3.1</version>
>                    <configuration>
>                        <source>1.6</source>
>                        <target>1.6</target>
>                    </configuration>
>                </plugin>
>            </plugins>
>        </pluginManagement>
>
> The error occurs in one of child artifact ('domain' in this case) so i
> checked it's effective POM and it correctly inherits the above config.
> The beauty is am able to build all projects successfully from 'parent' but
> the eclipse still reports compilation error on the annotated method.
> So i suppose this is something to do with eclipse rather than maven but not
> sure. What am i missing?
>
> Though not required my maven project setup is this (a multi module)
>
> parent
>  |
>  -- pom.xml
> core
>  |
>  --pom.xml
> domain
>  |
>  --pom.xml
>
>  Thanks much for your time.
>
> -Hari
>



-- 
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !