Plexus Components
  1. Plexus Components
  2. PLXCOMP-221

Trailing Root Directory is Added to sourcepath (and classpath)

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: plexus-compiler
    • Labels:
      None
    • Number of attachments :
      0

      Description

      The javac command generated by Maven contains a trailing colon or semi-colon depending on the OS. For example:

      -sourcepath <project>\src\main\java;

      which is equivalent to:

      -sourcepath <project>\src\main\java;

      Therefore, if a source file exists in the root directory under its project structure, the source file will be compiled.

      (Similarly, a trailing colon or semi-colon is added to the classpath.)

        Activity

        Hide
        Robert Scholte added a comment -

        This is probably the code responsible for the extra path-separator:

        org.codehaus.plexus.compiler.AbstractCompiler
             public static String getPathString( List<String> pathElements )
             {
                 StringBuilder sb = new StringBuilder();
         
                 for ( String pathElement : pathElements )
                 {
                     sb.append( pathElement ).append( File.pathSeparator );
                 }
         
                 return sb.toString();
             }
        
        
        Show
        Robert Scholte added a comment - This is probably the code responsible for the extra path-separator: org.codehaus.plexus.compiler.AbstractCompiler public static String getPathString( List< String > pathElements ) { StringBuilder sb = new StringBuilder(); for ( String pathElement : pathElements ) { sb.append( pathElement ).append( File.pathSeparator ); } return sb.toString(); }
        Hide
        Robert Scholte added a comment -

        I just noticed that the second -sourcepath should be:

        -sourcepath <project>\src\main\java;\ 
        Show
        Robert Scholte added a comment - I just noticed that the second -sourcepath should be: -sourcepath <project>\src\main\java;\

          People

          • Assignee:
            Unassigned
            Reporter:
            Clint Shank
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: