jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven 2.x Compiler Plugin
  • MCOMPILER-71

javac compilation error for package-info.java containing package annotation

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 2.0.2
  • Fix Version/s: backlog
  • Labels:
    None
  • Environment:
    Windows XP SP2
    JDK 1.5.0_15

Description

The package-info.java files can not be compiled in Maven 2 if the 2.0.2 maven-compiler-plugin is used. package-info.java files can be compiled by earlier versions of the maven-compiler-plugin (I have tried 2.0 and 2.0.1). Newer snapshot versions does not work also and it fails in the same error (I have tried version 2.1-snapshot).

This problem can be caused by an unusual behavior of the javac from jdk 1.5. This behavior is as follows:
You can not use '/' file separator during compiling package-info.java (for instance "javac sk/forro/package-info.java"). You must use '\' separator (for instance "javac sk\forro\package-info.java"). If you use the '/' separator you get the the compilation error reported by this bug (package annotations should be in file package-info.java). This is javac 'feature' has been removed in jdk 6 and in jdk 6 you can use either '/' or '\' - it does not matter.

It looks like the maven-compiler-plugin or one of its components (I mean plexus-x artefacts used by maven-compiler-plugin) uses '/' instead of the '\' in the MS Windows environment.

I have attached a log file of an unsuccessful build (generated by mvn install -X)

A possible workaround to solve this problem temporarily:
The compilation successes if I use either an older version of maven-compiler-plugin or jdk 6 or do not use package-info.java files at all.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    compile_error_2.0.2.log
    16/Apr/08 3:54 AM
    106 kB
    Gabriel Forro

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Rishabh Chandra added a comment - 06/May/09 12:18 AM

I have faced this issue myself. I tried both 2.0 and 2.0.1 and they did not work.
Then i used the excludes and got the code to compile. As the package-info file is only for javadoc I just ignored it. This is the only solution i could get to work.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<fork>true</fork>
<meminitial>128m</meminitial>
<maxmem>512m</maxmem>
<source>1.5</source>
<target>1.5</target>
<excludes>
<exclude>**/package-info.java</exclude>
</excludes>
</configuration>
</plugin>

Show
Rishabh Chandra added a comment - 06/May/09 12:18 AM I have faced this issue myself. I tried both 2.0 and 2.0.1 and they did not work. Then i used the excludes and got the code to compile. As the package-info file is only for javadoc I just ignored it. This is the only solution i could get to work. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <fork>true</fork> <meminitial>128m</meminitial> <maxmem>512m</maxmem> <source>1.5</source> <target>1.5</target> <excludes> <exclude>**/package-info.java</exclude> </excludes> </configuration> </plugin>
Hide
Permalink
Justin Edelson added a comment - 08/Jul/09 1:37 PM

package-info.java is not just for javadoc.

Show
Justin Edelson added a comment - 08/Jul/09 1:37 PM package-info.java is not just for javadoc.
Hide
Permalink
Stephen Connolly added a comment - 29/Aug/09 11:39 AM

At least when fork is true, this issue was introduced in r5396 of plexus

http://fisheye.codehaus.org/browse/plexus/plexus-components/trunk/plexus-compiler/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java?r1=5395&r2=5396

Show
Stephen Connolly added a comment - 29/Aug/09 11:39 AM At least when fork is true, this issue was introduced in r5396 of plexus http://fisheye.codehaus.org/browse/plexus/plexus-components/trunk/plexus-compiler/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java?r1=5395&r2=5396
Hide
Permalink
Stephen Connolly added a comment - 29/Aug/09 11:39 AM

line 622 of the above diff is one of the offending lines

Show
Stephen Connolly added a comment - 29/Aug/09 11:39 AM line 622 of the above diff is one of the offending lines
Hide
Permalink
Ivan Bogouchev added a comment - 27/Nov/09 8:32 AM

We experience the same problem and it seems this is a bug in javac 1.5 :

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6198196

Show
Ivan Bogouchev added a comment - 27/Nov/09 8:32 AM We experience the same problem and it seems this is a bug in javac 1.5 : http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6198196
Hide
Permalink
John Casey added a comment - 05/Feb/10 5:54 PM

I think I've got the offending lines fixed in 2.2-SNAPSHOT (or rather, in plexus-compiler-javac-1.7: http://svn.codehaus.org/plexus/plexus-components/trunk/plexus-compiler/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java).

Can someone please take a look to make sure? Even better: if you have a test case, and can specify where it will fail (for instance, does it fail on linux?) that would be great to include.

Show
John Casey added a comment - 05/Feb/10 5:54 PM I think I've got the offending lines fixed in 2.2-SNAPSHOT (or rather, in plexus-compiler-javac-1.7: http://svn.codehaus.org/plexus/plexus-components/trunk/plexus-compiler/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java). Can someone please take a look to make sure? Even better: if you have a test case, and can specify where it will fail (for instance, does it fail on linux?) that would be great to include.
Hide
Permalink
John Casey added a comment - 05/Feb/10 7:33 PM - edited

Okay, had to roll that change back. That wasn't the best way to go about things; it fails miserably.

FWIW, the failed commit is revId: 8627

http://fisheye.codehaus.org/browse/plexus/plexus-components/trunk/plexus-compiler/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java?r1=8626&r2=8627

Show
John Casey added a comment - 05/Feb/10 7:33 PM - edited Okay, had to roll that change back. That wasn't the best way to go about things; it fails miserably. FWIW, the failed commit is revId: 8627 http://fisheye.codehaus.org/browse/plexus/plexus-components/trunk/plexus-compiler/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java?r1=8626&r2=8627
Hide
Permalink
Luca De Petrillo added a comment - 13/Jan/12 5:58 AM

FYI: Using jdk 1.5.0_22, package-info.java files are compiled correctly.

I don't know exactly from what jdk version it started working, but I tried also with jdk 1.5.0_16 and seems to not works.

Show
Luca De Petrillo added a comment - 13/Jan/12 5:58 AM FYI: Using jdk 1.5.0_22, package-info.java files are compiled correctly. I don't know exactly from what jdk version it started working, but I tried also with jdk 1.5.0_16 and seems to not works.

People

  • Assignee:
    John Casey
    Reporter:
    Gabriel Forro
Vote (14)
Watch (12)

Dates

  • Created:
    16/Apr/08 3:54 AM
    Updated:
    Yesterday 2:56 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.