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)
Signup
Maven 2.x Compiler Plugin
  • Maven 2.x Compiler Plugin
  • MCOMPILER-98

-sourcepath not passed to javac

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 2.0.2
  • Fix Version/s: 2.2
  • Labels:
    None
  • Environment:
    Ubuntu 8.10, JDK 6.
  • Testcase included:
    yes
  • Patch Submitted:
    Yes
  • Number of attachments :
    2

Description

JavacCompiler.java (actually in plexus-compiler-javac, but I cannot find the source project for this anywhere) has

List sourceLocations = config.getSourceLocations();
if ( sourceLocations != null && !sourceLocations.isEmpty() && ( sourceFiles.length == 0 ) )

{ args.add( "-sourcepath" ); args.add( getPathString( sourceLocations ) ); }

The sourceFiles.length == 0 clause should be deleted. The problem is that javac really does need to have -sourcepath even when you are passing an explicit list of *.java files; it is necessary for 269-compliant annotation processors:

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

Following is a patch which

1. Fixes diagnostics to print compiler arguments even for unforked mode. (javac is still run with a command line when unforked, so there is no reason to omit this valuable diagnostic info.)

2. Hacks maven-compiler-plugin to work around the bug in plexus-compiler-javac and pass -sourcepath. Obviously a fix to p-c-j would be preferable.

When applied to m-c-p 2.0.2 it allows the test case to build.

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

Attachments

  1. Hide
    Zip Archive
    maven-6647998-test.zip
    13/Apr/09 9:47 PM
    8 kB
    Jesse Glick
    1. XML File
      maven-6647998-test/.../pom.xml 0.9 kB
    2. Java Source File
      maven-6647998-test/.../Proc.java 1 kB
    3. File
      maven-6647998-test/.../javax.annotation.processing.Processor 0.0 kB
    4. XML File
      maven-6647998-test/.../pom.xml 0.8 kB
    5. Java Source File
      maven-6647998-test/.../X.java 0.1 kB
    6. File
      maven-6647998-test/.../info 0.0 kB
    7. XML File
      maven-6647998-test/pom.xml 0.9 kB
    Download Zip
    Show
    Zip Archive
    maven-6647998-test.zip
    13/Apr/09 9:47 PM
    8 kB
    Jesse Glick
  2. File
    MCOMPILER-98.diff
    13/Apr/09 9:52 PM
    3 kB
    Jesse Glick

Issue Links

depends upon

Bug - A problem which impairs or prevents the functions of the product. MCOMPILER-66 Compiler swallows messages from annotation processors

  • Major - Major loss of function.
  • Open - The issue is open and ready for the assignee to start work on it.

Bug - A problem which impairs or prevents the functions of the product. MCOMPILER-97 META-INF/services/javax.annotation.processing.Processor copied before compilation and causes error

  • Major - Major loss of function.
  • Open - The issue is open and ready for the assignee to start work on it.

Bug - A problem which impairs or prevents the functions of the product. MCOMPILER-122 -sourcepath shall include resources

  • Major - Major loss of function.
  • Open - The issue is open and ready for the assignee to start work on it.
is depended upon by

New Feature - A new feature of the product, which has yet to be developed. MCOMPILER-75 Add apt support for Java 6

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Jesse Glick made changes - 13/Apr/09 9:48 PM
Field Original Value New Value
Link This issue is depended upon by MCOMPILER-75 [ MCOMPILER-75 ]
Hide
Permalink
Jesse Glick added a comment - 13/Apr/09 9:48 PM

269 support in general would require this to be fixed.

Show
Jesse Glick added a comment - 13/Apr/09 9:48 PM 269 support in general would require this to be fixed.
Jesse Glick made changes - 13/Apr/09 9:49 PM
Link This issue depends upon MCOMPILER-66 [ MCOMPILER-66 ]
Hide
Permalink
Jesse Glick added a comment - 13/Apr/09 9:49 PM - edited

Even if this were fixed, the expected output from the test case would be invisible unless MCOMPILER-66 were fixed too.

Show
Jesse Glick added a comment - 13/Apr/09 9:49 PM - edited Even if this were fixed, the expected output from the test case would be invisible unless MCOMPILER-66 were fixed too.
Jesse Glick made changes - 13/Apr/09 9:50 PM
Link This issue depends upon MCOMPILER-97 [ MCOMPILER-97 ]
Hide
Permalink
Jesse Glick added a comment - 13/Apr/09 9:50 PM - edited

MCOMPILER-97 has to be worked around in test case.

Show
Jesse Glick added a comment - 13/Apr/09 9:50 PM - edited MCOMPILER-97 has to be worked around in test case.
Hide
Permalink
Jesse Glick added a comment - 13/Apr/09 9:52 PM

Patch incl. better diagnostics and hotfix.

Show
Jesse Glick added a comment - 13/Apr/09 9:52 PM Patch incl. better diagnostics and hotfix.
Jesse Glick made changes - 13/Apr/09 9:52 PM
Attachment MCOMPILER-98.diff [ 41325 ]
Hide
Permalink
Jesse Glick added a comment - 13/Apr/09 9:58 PM

Workaround seems to be:

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArguments>
<sourcepath>$

{project.basedir}

/src/main/java</sourcepath>
</compilerArguments>
</configuration>
</plugin>
</plugins>
</build>

Show
Jesse Glick added a comment - 13/Apr/09 9:58 PM Workaround seems to be: <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <compilerArguments> <sourcepath>$ {project.basedir} /src/main/java</sourcepath> </compilerArguments> </configuration> </plugin> </plugins> </build>
Hide
Permalink
Milos Kleint added a comment - 19/Jan/10 4:12 AM

http://svn.apache.org/viewvc?rev=900690&view=rev
http://fisheye.codehaus.org/changelog/plexus/?cs=8590

the compiler plugin's trunk still references the 1.6 version of the javac compiler plugin.

Show
Milos Kleint added a comment - 19/Jan/10 4:12 AM http://svn.apache.org/viewvc?rev=900690&view=rev http://fisheye.codehaus.org/changelog/plexus/?cs=8590 the compiler plugin's trunk still references the 1.6 version of the javac compiler plugin.
Hide
Permalink
Jesse Glick added a comment - 10/Feb/10 11:22 AM

Note that for annotation processors which load non-Java resources from the sourcepath, the above fix will not suffice since it only includes Java sources. Untested workaround:

<compilerArguments>
<sourcepath>$

{project.basedir}/src/main/java:${project.basedir}

/src/main/resources</sourcepath>
</compilerArguments>

Show
Jesse Glick added a comment - 10/Feb/10 11:22 AM Note that for annotation processors which load non-Java resources from the sourcepath, the above fix will not suffice since it only includes Java sources. Untested workaround: <compilerArguments> <sourcepath>$ {project.basedir}/src/main/java:${project.basedir} /src/main/resources</sourcepath> </compilerArguments>
Hide
Permalink
Jesse Glick added a comment - 24/Feb/10 11:46 AM

Unfortunately just adding src/main/resources to -sourcepath does not suffice, due to a bug in javac:

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

(link may take a few days to work)

Show
Jesse Glick added a comment - 24/Feb/10 11:46 AM Unfortunately just adding src/main/resources to -sourcepath does not suffice, due to a bug in javac: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6929404 (link may take a few days to work)
Milos Kleint made changes - 28/Mar/10 2:46 PM
Assignee Milos Kleint [ mkleint ]
Hide
Permalink
Milos Kleint added a comment - 28/Mar/10 2:48 PM

I've opened the MCOMPILER-122 for the resources usecase. closing this one as the generic -sourcepath case is fixed.

Show
Milos Kleint added a comment - 28/Mar/10 2:48 PM I've opened the MCOMPILER-122 for the resources usecase. closing this one as the generic -sourcepath case is fixed.
Milos Kleint made changes - 28/Mar/10 2:48 PM
Status Open [ 1 ] Closed [ 6 ]
Fix Version/s 2.2 [ 16097 ]
Resolution Fixed [ 1 ]
Jesse Glick made changes - 30/Mar/10 10:13 PM
Link This issue depends upon MCOMPILER-122 [ MCOMPILER-122 ]

People

  • Assignee:
    Milos Kleint
    Reporter:
    Jesse Glick
Vote (8)
Watch (7)

Dates

  • Created:
    13/Apr/09 9:47 PM
    Updated:
    30/Mar/10 10:13 PM
    Resolved:
    28/Mar/10 2:48 PM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.