Any configuration inherited from the parent? Try removing the parent and see
if that changes things.
You could also execute
mvn help:effective-pom
and verify the effective configuration for the compiler plugin.

Also, executing
mvn compile -X
will get you loads of debug info.

Could it be that the compile is forked or some other compiler than javac is
configured?

/Anders

On Thu, May 6, 2010 at 22:27, Matthew Adams <[email protected]> wrote:

> I have a class that compiles fine using javac, but does not compile
> when building with the maven-compiler-plugin.
>
> Here's the class source.  Basic java.
>
> import java.lang.annotation.ElementType;
> import java.lang.annotation.Retention;
> import java.lang.annotation.RetentionPolicy;
> import java.lang.annotation.Target;
>
> @Target( { ElementType.METHOD, ElementType.CONSTRUCTOR })
> @Retention(RetentionPolicy.RUNTIME)
> public @interface RequiresMutability {
>    boolean value() default true;
>
>    Class<? extends RuntimeException> throws_() default
> RuntimeException.class;
> }
>
> When compiling with the following command, everything works fine:
>
> javac -source 1.6 -target 1.6 src/main/java/.../RequiresMutability.java
>
> When I compile using Maven, it barfs:
>
> [INFO] -------------------------------------------------------------
> [ERROR] COMPILATION ERROR :
> [INFO] -------------------------------------------------------------
> [ERROR]
> /home/madams/dev/commons-trunk/domain/src/main/java/org/piercecountywa/commons/domain/annotations/RequiresMutability.java:[21,72]
> incompatible types
> found   : java.lang.Class<java.lang.RuntimeException>
> required: java.lang.Class<? extends java.lang.RuntimeException>
>
> [INFO] 1error
> [INFO] -------------------------------------------------------------
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Compilation failure
>
> This project's pom has almost nothing in it besides the declaration of
> its parent and a few of dependencies:  one on another
> application-specific artifact, one on OpenJPA, and one on junit (with
> scope of test).  Its parent pom configures the maven-compiler-plugin:
>
>      <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-compiler-plugin</artifactId>
>        <version>2.3</version>
>        <configuration>
>          <source>1.6</source>
>          <target>1.6</target>
>        </configuration>
>      </plugin>
>
> Can anyone tell me why maven-compiler-plugin barfs on the class above
> but javac likes it just fine?
>
> $ mvn -version
> Apache Maven 2.2.1 (r801777; 2009-08-06 12:16:01-0700)
> Java version: 1.6.0_18
> Java home: /home/madams/programs/java/jdk1.6.0_18/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux" version: "2.6.32-22-generic" arch: "amd64" Family: "unix"
>
> -matthew
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to