-
Notifications
You must be signed in to change notification settings - Fork 61
Closed
Description
Using latest plexus-compiler-eclipse
(and ecj
), when changing a java file and just compiling without clean
, I'm getting:
Compilation failure
Unknown source: java.lang.IllegalArgumentException: File /home/foo/target/generated-sources/annotations/foo/SomeMapperImpl.java is specified more than once
The mapper is generated via mapstruct.
When adding -X
I can see here that the file is indeed passed twice to ECJ:
https://github.com/codehaus-plexus/plexus-compiler/blob/plexus-compiler-2.12.0/plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java#L357
Cause:
- file is added initially here (as expected): https://github.com/codehaus-plexus/plexus-compiler/blob/plexus-compiler-2.12.0/plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java#L247
- but it is added again via
addExtraSources()
:Lines 628 to 638 in f6c899b
private void addExtraSources( File dir, List<String> allSources ) { DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir( dir.getAbsolutePath() ); scanner.setIncludes( new String[]{ "**/*.java" } ); scanner.scan(); for ( String file : scanner.getIncludedFiles() ) { allSources.add( new File( dir, file ).getAbsolutePath() ); } }
Potential fix: use Set
or make addExtraSources()
more intelligent.
Metadata
Metadata
Assignees
Labels
No labels