Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Duplicate
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: plexus-compiler
-
Labels:None
-
Environment:Mac OS X 10.3, Windows XP, probably others
-
Number of attachments :
Description
I have only encountered this on Mac OS X 10.3, but the original reporter of MCOMPILER-43 encountered it in Windows XP.
Compiling via maven's compiler plugin, with the compilerId set to eclipse, not all of the .java files get turned into .class files.
I have tried using the eclipse compiler directly from the command line, and it doesn't have this problem.
I do not know whether this is an issue with maven-compiler-plugin, or with plexus-compiler-eclipse. But, given that maven-compiler-plugin works fine with plexus-compiler-javac, I would presume it is a problem with plexus-compiler-eclipse.
Issue Links
- is duplicated by
-
PLXCOMP-119
Eclipse compile plugin fails to copy files containing warnings (PATCH for bug + upgrade to JDT 3.4.2)
-
- is related to
-
MCOMPILER-43
Maven compiler creates ghost classes when invoked with a compilerId of 'eclipse'
-
I've had a look at the source for EclipseJavaCompiler.java.
It looks to me like it isn't creating a class file when there's any kind of problem, even if all of the problems are errors.
See the method acceptResult:
It only creates class files if result.hasProblems() returns false.
It should create class files when all of the problems are warnings.
if ( result.hasProblems() ) { IProblem[] problems = result.getProblems(); for ( int i = 0; i < problems.length; i++ ) { IProblem problem = problems[ i ]; String name = new String( problems[ i ].getOriginatingFileName() ); if ( problem.isWarning() ) { errors.add( handleWarning( problem ) ); } else { errors.add( handleError( name, problem.getSourceLineNumber(), -1, problem.getMessage() ) ); } } } else { ... }Should be changed to:
boolean errorFound = false; if ( result.hasProblems() ) { IProblem[] problems = result.getProblems(); for ( int i = 0; i < problems.length; i++ ) { IProblem problem = problems[ i ]; String name = new String( problems[ i ].getOriginatingFileName() ); if ( problem.isWarning() ) { errors.add( handleWarning( problem ) ); } else { errorFound = true; errors.add( handleError( name, problem.getSourceLineNumber(), -1, problem.getMessage() ) ); } } } if( !errorFound ) { ... }