maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andrew <lis...@pyroboy.com.au>
Subject [m2] build fails on compiler warning
Date Wed, 03 Aug 2005 03:14:32 GMT
Maven version: 2.0-beta-1-SNAPSHOT, and
Maven version: 2.0-alpha-3

Hi,

I'm attempting to compile a class that contains the now reserved word
'assert' as a identifier.

This compiles fine, with the requisite warnings, outside of m2.

Under m2, the compiler:compile goal produces the warnings and actually
compiles the class BUT the build fails [Listing 1].

I would expect the build to pass in this case.

Previously on this list I have seen it suggested that setting the source
compatibility to 1.4 may fix this. In my case, setting this [Listing 2]
results in no warning, no class file and a failed build [Listing 3].

Any suggestions on how I can get around this?

Even if I do away with the assert, will m2 fail the build on any
compiler warning?

Cheers,
...andrew

Listing 1

$ m2 clean:clean compiler:compile
[INFO] Using local copy of plugins.xml (plugin mappings) for group:
'org.apache.maven.plugins' from:
/home/amm/.m2/repository/org/apache/maven/plugins/plugins.xml
[INFO] maven-clean-plugin: resolved to version 2.0-alpha-3 from local
repository
[INFO] maven-compiler-plugin: resolved to version 2.0-alpha-3 from local
repository
[INFO]
----------------------------------------------------------------------------
[INFO] Building distra - numpty
[INFO]    task-segment: [clean:clean, compiler:compile]
[INFO]
----------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory
/secure/home/amm/prj/bt3/distra/numpty/numpty/target
[INFO] [compiler:compile]
Compiling 1 source file to
/secure/home/amm/prj/bt3/distra/numpty/numpty/target/classes
[INFO]
----------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
----------------------------------------------------------------------------
[INFO] Reason: Compilation failure
[INFO]
----------------------------------------------------------------------------
[INFO] no more tokens - could not parse error message:
/secure/home/amm/prj/bt3/distra/numpty/numpty/src/main/java/Numpty.java:4:
warning: as of release 1.4, assert is a keyword, and may not be used as
an identifier
  private static String assert = "Hello assert!"; // should trigger
compiler warning
                        ^

no more tokens - could not parse error message:
/secure/home/amm/prj/bt3/distra/numpty/numpty/src/main/java/Numpty.java:6:
warning: as of release 1.4, assert is a keyword, and may not be used as
an identifier
    System.out.println(assert);                   // should trigger
compiler warning
                       ^


[INFO]
----------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Wed Aug 03 13:08:26 EST 2005
[INFO] Final Memory: 2M/5M
[INFO]
----------------------------------------------------------------------------

Listing 2

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.0-alpha-3</version>
        <goals>
          <goal>
            <id>compile</id>
            <configuration>
              <source>1.4</source>
            </configuration>
          </goal>
        </goals>
      </plugin>
    </plugins>
  </build>

Listing 3

$ m2 clean:clean compiler:compile
[INFO] Using local copy of plugins.xml (plugin mappings) for group:
'org.apache.maven.plugins' from:
/home/amm/.m2/repository/org/apache/maven/plugins/plugins.xml
[INFO] maven-clean-plugin: resolved to version 2.0-alpha-3 from local
repository
[INFO]
----------------------------------------------------------------------------
[INFO] Building distra - numpty
[INFO]    task-segment: [clean:clean, compiler:compile]
[INFO]
----------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory
/secure/home/amm/prj/bt3/distra/numpty/numpty/target
[INFO] [compiler:compile]
Compiling 1 source file to
/secure/home/amm/prj/bt3/distra/numpty/numpty/target/classes
[INFO]
----------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
----------------------------------------------------------------------------
[INFO] Reason: Compilation failure
[INFO]
----------------------------------------------------------------------------
[INFO] Failure executing javac, but could not parse the error:



[INFO]
----------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Wed Aug 03 13:09:50 EST 2005
[INFO] Final Memory: 1M/3M
[INFO]
----------------------------------------------------------------------------

--

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message