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 index 39d0796b..6ffa414e 100644 --- a/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/pom.xml +++ b/plexus-compiler-its/src/main/it/eclipse-compiler-mapstruct/pom.xml @@ -24,18 +24,16 @@ 4.0.0 org.codehaus.plexus.compiler.it - simple-javac + eclipse-compiler-mapstruct 1.0-SNAPSHOT - Test for default configuration - UTF-8 UTF-8 1.8 1.8 @pom.version@ - 1.5.2.Final + 1.5.5.Final diff --git a/plexus-compiler-its/src/main/it/eclipse-compiler-procpath/invoker.properties b/plexus-compiler-its/src/main/it/eclipse-compiler-procpath/invoker.properties new file mode 100644 index 00000000..3b37b5f6 --- /dev/null +++ b/plexus-compiler-its/src/main/it/eclipse-compiler-procpath/invoker.properties @@ -0,0 +1,21 @@ +# 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.maven.version = 3.9.6+ + +invoker.goals = clean compile +invoker.buildResult = success diff --git a/plexus-compiler-its/src/main/it/eclipse-compiler-procpath/pom.xml b/plexus-compiler-its/src/main/it/eclipse-compiler-procpath/pom.xml new file mode 100644 index 00000000..c23ec93b --- /dev/null +++ b/plexus-compiler-its/src/main/it/eclipse-compiler-procpath/pom.xml @@ -0,0 +1,79 @@ + + + + + 4.0.0 + + org.codehaus.plexus.compiler.it + eclipse-compiler-procpath + 1.0-SNAPSHOT + + + UTF-8 + UTF-8 + 1.8 + 1.8 + @pom.version@ + 1.5.5.Final + + + + + org.mapstruct + mapstruct + ${org.mapstruct.version} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + @maven.compiler.version@ + + eclipse + + + org.mapstruct + mapstruct-processor + ${org.mapstruct.version} + + + + + + org.codehaus.plexus + plexus-compiler-api + ${plexus.compiler.version} + + + org.codehaus.plexus + plexus-compiler-eclipse + ${plexus.compiler.version} + + + + + + + diff --git a/plexus-compiler-its/src/main/it/eclipse-compiler-procpath/src/main/java/Car.java b/plexus-compiler-its/src/main/it/eclipse-compiler-procpath/src/main/java/Car.java new file mode 100644 index 00000000..80fe8cd4 --- /dev/null +++ b/plexus-compiler-its/src/main/it/eclipse-compiler-procpath/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-procpath/src/main/java/CarDto.java b/plexus-compiler-its/src/main/it/eclipse-compiler-procpath/src/main/java/CarDto.java new file mode 100644 index 00000000..285dd338 --- /dev/null +++ b/plexus-compiler-its/src/main/it/eclipse-compiler-procpath/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-procpath/src/main/java/CarMapper.java b/plexus-compiler-its/src/main/it/eclipse-compiler-procpath/src/main/java/CarMapper.java new file mode 100644 index 00000000..ba869a16 --- /dev/null +++ b/plexus-compiler-its/src/main/it/eclipse-compiler-procpath/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-procpath/verify.groovy b/plexus-compiler-its/src/main/it/eclipse-compiler-procpath/verify.groovy new file mode 100644 index 00000000..9cbd3c62 --- /dev/null +++ b/plexus-compiler-its/src/main/it/eclipse-compiler-procpath/verify.groovy @@ -0,0 +1,21 @@ +/* + * 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() + 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 ae5ff088..f14db674 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 @@ -147,7 +147,21 @@ public CompilerResult performCompile(CompilerConfiguration config) throws Compil args.add("-d"); args.add(config.getOutputLocation()); + // -- classpath + // must be done before annotation processors: https://bugs.eclipse.org/bugs/show_bug.cgi?id=573833 + List classpathEntries = new ArrayList<>(config.getClasspathEntries()); + classpathEntries.add(config.getOutputLocation()); + args.add("-classpath"); + args.add(getPathString(classpathEntries)); + + List modulepathEntries = config.getModulepathEntries(); + if (modulepathEntries != null && !modulepathEntries.isEmpty()) { + args.add("--module-path"); + args.add(getPathString(modulepathEntries)); + } + // Annotation processors defined? + // must be done after classpath: https://bugs.eclipse.org/bugs/show_bug.cgi?id=573833 if (!isPreJava1_6(config)) { File generatedSourcesDir = config.getGeneratedSourcesDirectory(); if (generatedSourcesDir != null) { @@ -198,18 +212,6 @@ public CompilerResult performCompile(CompilerConfiguration config) throws Compil } } - // -- classpath - List classpathEntries = new ArrayList<>(config.getClasspathEntries()); - classpathEntries.add(config.getOutputLocation()); - args.add("-classpath"); - args.add(getPathString(classpathEntries)); - - List modulepathEntries = config.getModulepathEntries(); - if (modulepathEntries != null && !modulepathEntries.isEmpty()) { - args.add("--module-path"); - args.add(getPathString(modulepathEntries)); - } - // Collect sources List allSources = Arrays.asList(getSourceFiles(config)); List messageList = new ArrayList<>();