diff --git a/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/invoker.properties b/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/invoker.properties
new file mode 100644
index 00000000..ddf39fcf
--- /dev/null
+++ b/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/invoker.properties
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.java.version = 1.8+
+
+# without-dummy profile is used to have compiler plugin do actual compilation in the second run
+invoker.name.1 = Initial build
+invoker.goals.1 = clean compile -Pwithout-dummy
+invoker.buildResult.1 = success
+
+invoker.name.2 = Subsequent build without clean
+invoker.goals.2 = compile
+invoker.buildResult.2 = success
diff --git a/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/pom.xml b/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/pom.xml
new file mode 100644
index 00000000..c72ca81e
--- /dev/null
+++ b/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/pom.xml
@@ -0,0 +1,98 @@
+
+
+
+
+ 4.0.0
+
+ org.codehaus.plexus.compiler.it
+ simple-javac
+ 1.0-SNAPSHOT
+
+ Test for default configuration
+
+
+ UTF-8
+ UTF-8
+ 1.8
+ 1.8
+
+ 1.5.2.Final
+
+
+
+
+ org.mapstruct
+ mapstruct
+ ${org.mapstruct.version}
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.10.1
+
+ eclipse
+
+
+
+ org.codehaus.plexus
+ plexus-compiler-api
+ @pom.version@
+
+
+ org.codehaus.plexus
+ plexus-compiler-eclipse
+ @pom.version@
+
+
+ org.mapstruct
+ mapstruct-processor
+ ${org.mapstruct.version}
+
+
+
+
+
+
+
+
+ without-dummy
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ **/Dummy.java
+
+
+
+
+
+
+
+
+
diff --git a/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/src/main/java/Car.java b/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/src/main/java/Car.java
new file mode 100644
index 00000000..80fe8cd4
--- /dev/null
+++ b/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/src/main/java/Car.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public class Car
+{
+ public String make;
+ public int numberOfSeats;
+}
diff --git a/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/src/main/java/CarDto.java b/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/src/main/java/CarDto.java
new file mode 100644
index 00000000..285dd338
--- /dev/null
+++ b/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/src/main/java/CarDto.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public class CarDto
+{
+ public String make;
+ public int seatCount;
+}
diff --git a/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/src/main/java/CarMapper.java b/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/src/main/java/CarMapper.java
new file mode 100644
index 00000000..ba869a16
--- /dev/null
+++ b/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/src/main/java/CarMapper.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.factory.Mappers;
+
+@Mapper
+public interface CarMapper
+{
+
+ CarMapper INSTANCE = Mappers.getMapper( CarMapper.class );
+
+ @Mapping( source = "numberOfSeats", target = "seatCount" )
+ CarDto carToCarDto( Car car );
+}
diff --git a/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/src/main/java/Dummy.java b/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/src/main/java/Dummy.java
new file mode 100644
index 00000000..6fcec063
--- /dev/null
+++ b/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/src/main/java/Dummy.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public class Dummy
+{
+
+}
diff --git a/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/verify.groovy b/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/verify.groovy
new file mode 100644
index 00000000..b7e8586e
--- /dev/null
+++ b/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/verify.groovy
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+def mapperImplClass = new File( basedir, "target/classes/CarMapperImpl.class" )
+assert mapperImplClass.exists()
+
+def dummyClass = new File( basedir, "target/classes/Dummy.class" )
+assert dummyClass.exists()
+
+File buildLog = new File( basedir, 'build.log' )
+assert buildLog.text.count( "Changes detected - recompiling the module!" ) == 2
diff --git a/plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java b/plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java
index 3bbb781c..330936d3 100644
--- a/plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java
+++ b/plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java
@@ -37,15 +37,12 @@
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
import java.util.ArrayList;
-import java.util.HashSet;
+import java.util.Arrays;
import java.util.Iterator;
-import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map.Entry;
import java.util.ServiceLoader;
-import java.util.Set;
-
import org.codehaus.plexus.compiler.AbstractCompiler;
import org.codehaus.plexus.compiler.Compiler;
import org.codehaus.plexus.compiler.CompilerConfiguration;
@@ -54,7 +51,6 @@
import org.codehaus.plexus.compiler.CompilerOutputStyle;
import org.codehaus.plexus.compiler.CompilerResult;
import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.StringUtils;
import org.eclipse.jdt.core.compiler.CompilationProgress;
import org.eclipse.jdt.core.compiler.batch.BatchCompiler;
@@ -169,14 +165,12 @@ public CompilerResult performCompile( CompilerConfiguration config )
args.add( config.getOutputLocation() );
// Annotation processors defined?
- List extraSourceDirs = new ArrayList<>();
if ( !isPreJava1_6( config ) )
{
File generatedSourcesDir = config.getGeneratedSourcesDirectory();
if ( generatedSourcesDir != null )
{
generatedSourcesDir.mkdirs();
- extraSourceDirs.add( generatedSourcesDir.getAbsolutePath() );
//-- option to specify where annotation processor is to generate its output
args.add( "-s" );
@@ -247,24 +241,7 @@ public CompilerResult performCompile( CompilerConfiguration config )
}
// Collect sources
- Set allSources = new HashSet<>();
- for ( String source : config.getSourceLocations() )
- {
- File srcFile = new File( source );
- if ( srcFile.exists() )
- {
- Set ss = getSourceFilesForSourceRoot( config, source );
- allSources.addAll( ss );
- }
- }
- for ( String extraSrcDir : extraSourceDirs )
- {
- File extraDir = new File( extraSrcDir );
- if ( extraDir.isDirectory() )
- {
- addExtraSources( extraDir, allSources );
- }
- }
+ List allSources = Arrays.asList( getSourceFiles( config ) );
List messageList = new ArrayList<>();
if ( allSources.isEmpty() )
{
@@ -504,9 +481,9 @@ static boolean isReplaceProcessorPath( CompilerConfiguration config )
return false;
}
- static Set resortSourcesToPutModuleInfoFirst( Set allSources )
+ static List resortSourcesToPutModuleInfoFirst( List allSources )
{
- Set resorted = new LinkedHashSet<>( allSources.size() );
+ List resorted = new ArrayList<>( allSources.size() );
for ( String mi : allSources )
{
@@ -654,18 +631,6 @@ private JavaCompiler getEcj()
return null;
}
- private void addExtraSources( File dir, Set 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() );
- }
- }
-
private CompilerMessage.Kind convert( Diagnostic.Kind kind )
{
if ( kind == null )
diff --git a/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompilerTest.java b/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompilerTest.java
index 239d1cc8..095efe64 100644
--- a/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompilerTest.java
+++ b/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompilerTest.java
@@ -4,8 +4,7 @@
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
-import java.util.LinkedHashSet;
-import java.util.Set;
+import java.util.List;
import java.util.stream.Stream;
import static java.util.Arrays.asList;
@@ -15,42 +14,42 @@ class EclipseJavaCompilerTest
{
@ParameterizedTest
@MethodSource( "sources" )
- void testReorderedSources( Set expected, Set inputSources )
+ void testReorderedSources( List expected, List inputSources )
{
- Set resorted = EclipseJavaCompiler.resortSourcesToPutModuleInfoFirst( inputSources );
+ List resorted = EclipseJavaCompiler.resortSourcesToPutModuleInfoFirst( inputSources );
assertEquals( expected, resorted );
}
static Stream sources()
{
- Set expectedOrder = new LinkedHashSet<>( asList(
+ List expectedOrder = asList(
"module-info.java",
"plexus/A.java",
"plexus/B.java",
"eclipse/A.java"
- ) );
+ );
- Set moduleInfoAlreadyFirst = new LinkedHashSet<>( asList(
+ List moduleInfoAlreadyFirst = asList(
"module-info.java",
"plexus/A.java",
"plexus/B.java",
"eclipse/A.java"
- ) );
+ );
- Set moduleInfoSomewhereInTheMiddle = new LinkedHashSet<>( asList(
+ List moduleInfoSomewhereInTheMiddle = asList(
"plexus/A.java",
"module-info.java",
"plexus/B.java",
"eclipse/A.java"
- ) );
+ );
- Set moduleInfoAsLast = new LinkedHashSet<>( asList(
+ List moduleInfoAsLast = asList(
"plexus/A.java",
"plexus/B.java",
"eclipse/A.java",
"module-info.java"
- ) );
+ );
return Stream.of(
Arguments.arguments( expectedOrder, moduleInfoAlreadyFirst ),