From 9ba766d2d26cec06ad4739f64dbdcf2f0b1a041e Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Wed, 20 Dec 2023 21:25:35 +0100 Subject: [PATCH 01/20] [maven-release-plugin] prepare for next development iteration --- plexus-compiler-api/pom.xml | 2 +- plexus-compiler-its/pom.xml | 2 +- plexus-compiler-manager/pom.xml | 2 +- plexus-compiler-test/pom.xml | 2 +- plexus-compilers/plexus-compiler-aspectj/pom.xml | 2 +- plexus-compilers/plexus-compiler-csharp/pom.xml | 2 +- plexus-compilers/plexus-compiler-eclipse/pom.xml | 2 +- plexus-compilers/plexus-compiler-javac-errorprone/pom.xml | 2 +- plexus-compilers/plexus-compiler-javac/pom.xml | 2 +- plexus-compilers/pom.xml | 2 +- pom.xml | 6 +++--- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/plexus-compiler-api/pom.xml b/plexus-compiler-api/pom.xml index 5d712ba6..d67915b0 100644 --- a/plexus-compiler-api/pom.xml +++ b/plexus-compiler-api/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compiler - 2.14.2 + 2.14.3-SNAPSHOT plexus-compiler-api diff --git a/plexus-compiler-its/pom.xml b/plexus-compiler-its/pom.xml index 9cfda9f1..1264cec5 100644 --- a/plexus-compiler-its/pom.xml +++ b/plexus-compiler-its/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compiler - 2.14.2 + 2.14.3-SNAPSHOT plexus-compiler-its diff --git a/plexus-compiler-manager/pom.xml b/plexus-compiler-manager/pom.xml index 74d40139..f1576a36 100644 --- a/plexus-compiler-manager/pom.xml +++ b/plexus-compiler-manager/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compiler - 2.14.2 + 2.14.3-SNAPSHOT plexus-compiler-manager diff --git a/plexus-compiler-test/pom.xml b/plexus-compiler-test/pom.xml index f80f1b4b..f16b42e4 100644 --- a/plexus-compiler-test/pom.xml +++ b/plexus-compiler-test/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compiler - 2.14.2 + 2.14.3-SNAPSHOT plexus-compiler-test diff --git a/plexus-compilers/plexus-compiler-aspectj/pom.xml b/plexus-compilers/plexus-compiler-aspectj/pom.xml index 9584b07a..38681fc4 100644 --- a/plexus-compilers/plexus-compiler-aspectj/pom.xml +++ b/plexus-compilers/plexus-compiler-aspectj/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compilers - 2.14.2 + 2.14.3-SNAPSHOT plexus-compiler-aspectj diff --git a/plexus-compilers/plexus-compiler-csharp/pom.xml b/plexus-compilers/plexus-compiler-csharp/pom.xml index dadb83e6..495785f0 100644 --- a/plexus-compilers/plexus-compiler-csharp/pom.xml +++ b/plexus-compilers/plexus-compiler-csharp/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compilers - 2.14.2 + 2.14.3-SNAPSHOT plexus-compiler-csharp diff --git a/plexus-compilers/plexus-compiler-eclipse/pom.xml b/plexus-compilers/plexus-compiler-eclipse/pom.xml index bb8913d6..5017ceab 100644 --- a/plexus-compilers/plexus-compiler-eclipse/pom.xml +++ b/plexus-compilers/plexus-compiler-eclipse/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compilers - 2.14.2 + 2.14.3-SNAPSHOT plexus-compiler-eclipse diff --git a/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml b/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml index 967ac3c8..aa951fb4 100644 --- a/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml +++ b/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compilers - 2.14.2 + 2.14.3-SNAPSHOT plexus-compiler-javac-errorprone diff --git a/plexus-compilers/plexus-compiler-javac/pom.xml b/plexus-compilers/plexus-compiler-javac/pom.xml index 3440da79..63ac8b57 100644 --- a/plexus-compilers/plexus-compiler-javac/pom.xml +++ b/plexus-compilers/plexus-compiler-javac/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compilers - 2.14.2 + 2.14.3-SNAPSHOT plexus-compiler-javac diff --git a/plexus-compilers/pom.xml b/plexus-compilers/pom.xml index 6f741fc7..fcea9983 100644 --- a/plexus-compilers/pom.xml +++ b/plexus-compilers/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compiler - 2.14.2 + 2.14.3-SNAPSHOT plexus-compilers diff --git a/pom.xml b/pom.xml index 86debbd6..463e64f4 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ plexus-compiler - 2.14.2 + 2.14.3-SNAPSHOT pom Plexus Compiler @@ -26,7 +26,7 @@ ${scm.url} ${scm.url} - plexus-compiler-2.14.2 + HEAD http://github.com/codehaus-plexus/plexus-compiler/tree/${project.scm.tag}/ @@ -44,7 +44,7 @@ scm:git:git@github.com:codehaus-plexus/plexus-compiler.git 8 true - 2023-12-20T20:24:00Z + 2023-12-20T20:25:35Z 5.10.1 1.9.21 3.5.4 From 6ae79d7f2feca3a02e75f7661468abac6a9a0a11 Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Fri, 22 Dec 2023 12:48:18 +0700 Subject: [PATCH 02/20] Report "Error occurred during initialization of VM" as error Until now, this error message was just swallowed silently. Along the way, also report "Error occurred during initialization of boot layer" as ERROR, because probably OTHER was never the right category to begin with. With OTHER, Maven Compiler logs both error messages on INFO, which I believe to be wrong. Now, Maven Compiler logs them on ERROR with "COMPILATION ERROR" header, which fits the behaviour that the build fails. Besides, javadoc for CompilerMessage.Kind.ERROR says "Problem which prevents the tool's normal completion", which also is a good description of what is actually happening for both the boot layer and VM init errors. --- .../plexus/compiler/javac/JavacCompiler.java | 8 +++++--- .../compiler/javac/ErrorMessageParserTest.java | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java b/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java index 1e97f8e7..0255c2a7 100644 --- a/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java +++ b/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java @@ -638,6 +638,10 @@ private static CompilerResult compileInProcess0(Class javacClass, String[] ar private static final Pattern STACK_TRACE_OTHER_LINE = Pattern.compile("^(?:Caused by:\\s.*|\\s*at .*|\\s*\\.\\.\\.\\s\\d+\\smore)$"); + // Match generic javac errors with 'javac:' prefix, JMV init and boot layer init errors + private static final Pattern JAVAC_OR_JVM_ERROR = + Pattern.compile("^(?:javac:|Error occurred during initialization of (?:boot layer|VM)).*", Pattern.DOTALL); + /** * Parse the output from the compiler into a list of CompilerMessage objects * @@ -664,10 +668,8 @@ static List parseModernStream(int exitCode, BufferedReader inpu // maybe better to ignore only the summary and mark the rest as error String bufferAsString = buffer.toString(); if (buffer.length() > 0) { - if (bufferAsString.startsWith("javac:")) { + if (JAVAC_OR_JVM_ERROR.matcher(bufferAsString).matches()) { errors.add(new CompilerMessage(bufferAsString, CompilerMessage.Kind.ERROR)); - } else if (bufferAsString.startsWith("Error occurred during initialization of boot layer")) { - errors.add(new CompilerMessage(bufferAsString, CompilerMessage.Kind.OTHER)); } else if (hasPointer) { // A compiler message remains in buffer at end of parse stream errors.add(parseModernError(exitCode, bufferAsString)); diff --git a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/ErrorMessageParserTest.java b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/ErrorMessageParserTest.java index d8f01590..5ab3c822 100644 --- a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/ErrorMessageParserTest.java +++ b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/ErrorMessageParserTest.java @@ -1010,7 +1010,7 @@ public void testIssue37() throws IOException { } @Test - public void testJvmError() throws Exception { + public void testJvmBootLayerInitializationError() throws Exception { String out = "Error occurred during initialization of boot layer" + EOL + "java.lang.module.FindException: Module java.xml.bind not found"; @@ -1018,8 +1018,21 @@ public void testJvmError() throws Exception { JavacCompiler.parseModernStream(1, new BufferedReader(new StringReader(out))); assertThat(compilerErrors, notNullValue()); + assertThat(compilerErrors.size(), is(1)); + assertThat(compilerErrors.get(0).getKind(), is(CompilerMessage.Kind.ERROR)); + } + + @Test + public void testJvmInitializationError() throws Exception { + String out = "Error occurred during initialization of VM" + EOL + + "Initial heap size set to a larger value than the maximum heap size"; + List compilerErrors = + JavacCompiler.parseModernStream(1, new BufferedReader(new StringReader(out))); + + assertThat(compilerErrors, notNullValue()); assertThat(compilerErrors.size(), is(1)); + assertThat(compilerErrors.get(0).getKind(), is(CompilerMessage.Kind.ERROR)); } @Test From d03c4dd3fe5d9fa77a28361e7870a3c3faff7954 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Dec 2023 21:50:31 +0000 Subject: [PATCH 03/20] Bump org.codehaus.plexus:plexus-component-annotations Bumps [org.codehaus.plexus:plexus-component-annotations](https://github.com/codehaus-plexus/plexus-containers) from 2.1.1 to 2.2.0. - [Release notes](https://github.com/codehaus-plexus/plexus-containers/releases) - [Changelog](https://github.com/codehaus-plexus/plexus-containers/blob/master/ReleaseNotes.md) - [Commits](https://github.com/codehaus-plexus/plexus-containers/compare/plexus-containers-2.1.1...plexus-containers-2.2.0) --- updated-dependencies: - dependency-name: org.codehaus.plexus:plexus-component-annotations dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 463e64f4..340bf7b4 100644 --- a/pom.xml +++ b/pom.xml @@ -89,7 +89,7 @@ org.codehaus.plexus plexus-component-annotations - 2.1.1 + 2.2.0 javax.inject From ff38ac94faa6dfe7f78827d82b9c3d173bda9dac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Dec 2023 21:36:26 +0000 Subject: [PATCH 04/20] Bump com.google.errorprone:error_prone_core from 2.23.0 to 2.24.0 Bumps [com.google.errorprone:error_prone_core](https://github.com/google/error-prone) from 2.23.0 to 2.24.0. - [Release notes](https://github.com/google/error-prone/releases) - [Commits](https://github.com/google/error-prone/compare/v2.23.0...v2.24.0) --- updated-dependencies: - dependency-name: com.google.errorprone:error_prone_core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 340bf7b4..00c8d14f 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ 5.10.1 1.9.21 3.5.4 - 2.23.0 + 2.24.0 false clean install 3.12.0 From ee40a6a82aa5b42a2fd951044d446dd4c5a051fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Dec 2023 21:50:35 +0000 Subject: [PATCH 05/20] Bump org.apache.maven.plugins:maven-compiler-plugin Bumps [org.apache.maven.plugins:maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.12.0 to 3.12.1. - [Release notes](https://github.com/apache/maven-compiler-plugin/releases) - [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.12.0...maven-compiler-plugin-3.12.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-compiler-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 00c8d14f..33729a3c 100644 --- a/pom.xml +++ b/pom.xml @@ -51,7 +51,7 @@ 2.24.0 false clean install - 3.12.0 + 3.12.1 From 37e39f2121d724b83e824bac808b3f6e480d158c Mon Sep 17 00:00:00 2001 From: Falko Modler Date: Fri, 5 Jan 2024 13:18:41 +0100 Subject: [PATCH 06/20] Fix ECJ not using annotation processor when defined via processorpath Works around https://bugs.eclipse.org/bugs/show_bug.cgi?id=573833 by adding -classpath to the command line before -processorpath is added. Fixes #349 --- .../it/eclipse-compiler-mapstruct/pom.xml | 6 +- .../invoker.properties | 21 +++++ .../main/it/eclipse-compiler-procpath/pom.xml | 79 +++++++++++++++++++ .../src/main/java/Car.java | 24 ++++++ .../src/main/java/CarDto.java | 24 ++++++ .../src/main/java/CarMapper.java | 32 ++++++++ .../eclipse-compiler-procpath/verify.groovy | 21 +++++ .../compiler/eclipse/EclipseJavaCompiler.java | 26 +++--- 8 files changed, 217 insertions(+), 16 deletions(-) create mode 100644 plexus-compiler-its/src/main/it/eclipse-compiler-procpath/invoker.properties create mode 100644 plexus-compiler-its/src/main/it/eclipse-compiler-procpath/pom.xml create mode 100644 plexus-compiler-its/src/main/it/eclipse-compiler-procpath/src/main/java/Car.java create mode 100644 plexus-compiler-its/src/main/it/eclipse-compiler-procpath/src/main/java/CarDto.java create mode 100644 plexus-compiler-its/src/main/it/eclipse-compiler-procpath/src/main/java/CarMapper.java create mode 100644 plexus-compiler-its/src/main/it/eclipse-compiler-procpath/verify.groovy 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<>(); From b59dc4c2a63398f51ab7839a33e6e3b1c0a31c42 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jan 2024 21:07:01 +0000 Subject: [PATCH 07/20] Bump com.google.errorprone:error_prone_core from 2.24.0 to 2.24.1 Bumps [com.google.errorprone:error_prone_core](https://github.com/google/error-prone) from 2.24.0 to 2.24.1. - [Release notes](https://github.com/google/error-prone/releases) - [Commits](https://github.com/google/error-prone/compare/v2.24.0...v2.24.1) --- updated-dependencies: - dependency-name: com.google.errorprone:error_prone_core dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 33729a3c..1c7c015e 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ 5.10.1 1.9.21 3.5.4 - 2.24.0 + 2.24.1 false clean install 3.12.1 From f779b08a545ab18d01534d25975537c99ec65c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Tue, 30 Jan 2024 09:37:58 +0100 Subject: [PATCH 08/20] Use a TreeSet instead of HashSet to get consistent ordering of results (#352) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently a HashSet is used to collect the source files, this means that the order returned is unspecified and in the worst case even random across machines/jvms. In some rare cases it could happen that this even has a slight influence on the produced class files if sources are processed in different order and therefore threat reproducible builds. This now uses a TreeSet instead of a HashSet so the results are always in a deterministic order using the String#compare contract. Co-authored-by: Christoph Läubrich --- .../codehaus/plexus/compiler/AbstractCompiler.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/AbstractCompiler.java b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/AbstractCompiler.java index 13f5b47b..7a3a4a52 100644 --- a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/AbstractCompiler.java +++ b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/AbstractCompiler.java @@ -26,9 +26,9 @@ import java.io.File; import java.io.IOException; import java.util.Collections; -import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.TreeSet; import org.codehaus.plexus.util.DirectoryScanner; import org.slf4j.Logger; @@ -99,18 +99,22 @@ protected org.codehaus.plexus.logging.Logger getLogger() { public abstract String getCompilerId(); + @Override public CompilerResult performCompile(CompilerConfiguration configuration) throws CompilerException { throw new CompilerNotImplementedException("The performCompile method has not been implemented."); } + @Override public CompilerOutputStyle getCompilerOutputStyle() { return compilerOutputStyle; } + @Override public String getInputFileEnding(CompilerConfiguration configuration) throws CompilerException { return inputFileEnding; } + @Override public String getOutputFileEnding(CompilerConfiguration configuration) throws CompilerException { if (compilerOutputStyle != CompilerOutputStyle.ONE_OUTPUT_FILE_PER_INPUT_FILE) { throw new RuntimeException("This compiler implementation doesn't have one output file per input file."); @@ -119,6 +123,7 @@ public String getOutputFileEnding(CompilerConfiguration configuration) throws Co return outputFileEnding; } + @Override public String getOutputFile(CompilerConfiguration configuration) throws CompilerException { if (compilerOutputStyle != CompilerOutputStyle.ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES) { throw new RuntimeException("This compiler implementation doesn't have one output file for all files."); @@ -127,6 +132,7 @@ public String getOutputFile(CompilerConfiguration configuration) throws Compiler return outputFile; } + @Override public boolean canUpdateTarget(CompilerConfiguration configuration) throws CompilerException { return true; } @@ -174,7 +180,7 @@ protected static Set getSourceFilesForSourceRoot(CompilerConfiguration c String[] sourceDirectorySources = scanner.getIncludedFiles(); - Set sources = new HashSet<>(); + Set sources = new TreeSet<>(); for (String sourceDirectorySource : sourceDirectorySources) { File f = new File(sourceLocation, sourceDirectorySource); @@ -186,7 +192,7 @@ protected static Set getSourceFilesForSourceRoot(CompilerConfiguration c } protected static String[] getSourceFiles(CompilerConfiguration config) { - Set sources = new HashSet<>(); + Set sources = new TreeSet<>(); Set sourceFiles = config.getSourceFiles(); From c5edddc7deaf32d966db3262dfde21c565d51e25 Mon Sep 17 00:00:00 2001 From: Sylwester Lachiewicz Date: Mon, 27 Nov 2023 16:24:51 +0100 Subject: [PATCH 09/20] Require Maven 3.6.3+ --- plexus-compiler-test/pom.xml | 8 ++++---- pom.xml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plexus-compiler-test/pom.xml b/plexus-compiler-test/pom.xml index f16b42e4..3dcab953 100644 --- a/plexus-compiler-test/pom.xml +++ b/plexus-compiler-test/pom.xml @@ -36,22 +36,22 @@ org.apache.maven maven-artifact - ${maven.version} + ${mavenVersion} org.apache.maven maven-core - ${maven.version} + ${mavenVersion} org.apache.maven maven-compat - ${maven.version} + ${mavenVersion} org.apache.maven maven-settings - ${maven.version} + ${mavenVersion} org.codehaus.plexus diff --git a/pom.xml b/pom.xml index 1c7c015e..13171985 100644 --- a/pom.xml +++ b/pom.xml @@ -45,9 +45,9 @@ 8 true 2023-12-20T20:25:35Z - 5.10.1 1.9.21 - 3.5.4 + 3.6.3 + ${mavenVersion} 2.24.1 false clean install @@ -99,7 +99,7 @@ org.junit junit-bom - ${jupiter.version} + ${junit5Version} pom import @@ -136,7 +136,7 @@ org.codehaus.plexus plexus-xml - 4.0.1 + 3.0.0 From aa4e8e2e7d1022f6f189b0f286a031a674fa3266 Mon Sep 17 00:00:00 2001 From: Konrad Windszus Date: Sat, 3 Feb 2024 11:11:25 +0100 Subject: [PATCH 10/20] Correctly determine the version of the underlying javac tool (#357) Ignore and deprecate CompilerConfiguration values as they are unreliable (and don't represent the used javac version) Make test execution more resilient by interpolating settings.xml correctly and make sure commons-lang 2.0 is resolved prior to unit testing This closes #356 --- .../compiler/CompilerConfiguration.java | 10 + plexus-compiler-test/pom.xml | 2 +- .../plexus/compiler/AbstractCompilerTest.java | 16 +- .../plexus/compiler/javac/JavacCompiler.java | 258 +++++++++--------- .../javac/AbstractJavacCompilerTest.java | 63 ++--- .../compiler/javac/JavacCompilerTest.java | 23 ++ plexus-compilers/pom.xml | 7 + 7 files changed, 208 insertions(+), 171 deletions(-) diff --git a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerConfiguration.java b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerConfiguration.java index 2907988e..a1680c2e 100644 --- a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerConfiguration.java +++ b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerConfiguration.java @@ -500,10 +500,20 @@ public void setOptimize(boolean optimize) { this.optimize = optimize; } + /** + * @deprecated Don't use any longer because this is just the configured version which does not necessarily match the version + * of the actually executed compiler binary + */ + @Deprecated public String getCompilerVersion() { return compilerVersion; } + /** + * @deprecated Don't use any longer because this is just the configured version which does not necessarily match the version + * of the actually executed compiler binary + */ + @Deprecated public void setCompilerVersion(String compilerVersion) { this.compilerVersion = compilerVersion; } diff --git a/plexus-compiler-test/pom.xml b/plexus-compiler-test/pom.xml index 3dcab953..d3f45562 100644 --- a/plexus-compiler-test/pom.xml +++ b/plexus-compiler-test/pom.xml @@ -50,7 +50,7 @@ org.apache.maven - maven-settings + maven-settings-builder ${mavenVersion} diff --git a/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java b/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java index 977ffbd1..85374c54 100644 --- a/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java +++ b/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java @@ -41,11 +41,13 @@ import org.apache.maven.artifact.repository.DefaultArtifactRepository; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.artifact.versioning.VersionRange; +import org.apache.maven.properties.internal.SystemProperties; import org.apache.maven.settings.Settings; -import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader; +import org.apache.maven.settings.building.DefaultSettingsBuilderFactory; +import org.apache.maven.settings.building.DefaultSettingsBuildingRequest; +import org.apache.maven.settings.building.SettingsBuildingRequest; import org.codehaus.plexus.testing.PlexusTest; import org.codehaus.plexus.util.FileUtils; -import org.codehaus.plexus.util.ReaderFactory; import org.codehaus.plexus.util.StringUtils; import org.hamcrest.io.FileMatchers; import org.junit.jupiter.api.BeforeEach; @@ -83,7 +85,13 @@ final void setUpLocalRepo() throws Exception { if (localRepo == null) { File settingsFile = new File(System.getProperty("user.home"), ".m2/settings.xml"); if (settingsFile.exists()) { - Settings settings = new SettingsXpp3Reader().read(ReaderFactory.newXmlReader(settingsFile)); + SettingsBuildingRequest request = new DefaultSettingsBuildingRequest(); + request.setUserSettingsFile(settingsFile); + request.setSystemProperties(SystemProperties.getSystemProperties()); + Settings settings = new DefaultSettingsBuilderFactory() + .newInstance() + .build(request) + .getEffectiveSettings(); localRepo = settings.getLocalRepository(); } } @@ -116,7 +124,7 @@ protected List getClasspath() throws Exception { File file = getLocalArtifactPath("commons-lang", "commons-lang", "2.0", "jar"); assertThat( - "test prerequisite: commons-lang library must be available in local repository, expected ", + "test prerequisite: commons-lang library must be available in local repository at " + file, file, FileMatchers.aReadableFile()); diff --git a/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java b/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java index 0255c2a7..f7154566 100644 --- a/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java +++ b/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java @@ -59,12 +59,16 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Deque; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import java.util.Properties; +import java.util.Set; import java.util.StringTokenizer; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedDeque; +import java.util.regex.Matcher; import java.util.regex.Pattern; import org.codehaus.plexus.compiler.AbstractCompiler; @@ -108,6 +112,11 @@ public class JavacCompiler extends AbstractCompiler { private final Deque> javacClasses = new ConcurrentLinkedDeque<>(); + private static final Pattern JAVA_MAJOR_AND_MINOR_VERSION_PATTERN = Pattern.compile("\\d+(\\.\\d+)?"); + + /** Cache of javac version per executable (never invalidated) */ + private static final Map VERSION_PER_EXECUTABLE = new ConcurrentHashMap<>(); + @Inject private InProcessCompiler inProcessCompiler; @@ -128,6 +137,44 @@ public String getCompilerId() { return "javac"; } + private String getInProcessJavacVersion() throws CompilerException { + return System.getProperty("java.version"); + } + + private String getOutOfProcessJavacVersion(String executable) throws CompilerException { + String version = VERSION_PER_EXECUTABLE.get(executable); + if (version == null) { + Commandline cli = new Commandline(); + cli.setExecutable(executable); + /* + * The option "-version" should be supported by javac since 1.6 (https://docs.oracle.com/javase/6/docs/technotes/tools/solaris/javac.html) + * up to 21 (https://docs.oracle.com/en/java/javase/21/docs/specs/man/javac.html#standard-options) + */ + cli.addArguments(new String[] {"-version"}); // + CommandLineUtils.StringStreamConsumer out = new CommandLineUtils.StringStreamConsumer(); + try { + int exitCode = CommandLineUtils.executeCommandLine(cli, out, out); + if (exitCode != 0) { + throw new CompilerException("Could not retrieve version from " + executable + ". Exit code " + + exitCode + ", Output: " + out.getOutput()); + } + } catch (CommandLineException e) { + throw new CompilerException("Error while executing the external compiler " + executable, e); + } + version = extractMajorAndMinorVersion(out.getOutput()); + VERSION_PER_EXECUTABLE.put(executable, version); + } + return version; + } + + static String extractMajorAndMinorVersion(String text) { + Matcher matcher = JAVA_MAJOR_AND_MINOR_VERSION_PATTERN.matcher(text); + if (!matcher.find()) { + throw new IllegalArgumentException("Could not extract version from \"" + text + "\""); + } + return matcher.group(); + } + @Override public CompilerResult performCompile(CompilerConfiguration config) throws CompilerException { File destinationDir = new File(config.getOutputLocation()); @@ -144,27 +191,25 @@ public CompilerResult performCompile(CompilerConfiguration config) throws Compil logCompiling(sourceFiles, config); - String[] args = buildCompilerArguments(config, sourceFiles); + final String javacVersion; + final String executable; + if (config.isFork()) { + executable = getJavacExecutable(config); + javacVersion = getOutOfProcessJavacVersion(executable); + } else { + javacVersion = getInProcessJavacVersion(); + executable = null; + } + + String[] args = buildCompilerArguments(config, sourceFiles, javacVersion); CompilerResult result; if (config.isFork()) { - String executable = config.getExecutable(); - - if (StringUtils.isEmpty(executable)) { - try { - executable = getJavacExecutable(); - } catch (IOException e) { - if (getLog().isWarnEnabled()) { - getLog().warn("Unable to autodetect 'javac' path, using 'javac' from the environment."); - } - executable = "javac"; - } - } result = compileOutOfProcess(config, executable, args); } else { - if (isJava16() && !config.isForceJavacCompilerUse()) { + if (hasJavaxToolProvider() && !config.isForceJavacCompilerUse()) { // use fqcn to prevent loading of the class on 1.5 environment ! result = inProcessCompiler().compileInProcess(args, config, sourceFiles); } else { @@ -179,7 +224,11 @@ protected InProcessCompiler inProcessCompiler() { return inProcessCompiler; } - protected static boolean isJava16() { + /** + * + * @return {@code true} if the current context class loader has access to {@code javax.tools.ToolProvider} + */ + protected static boolean hasJavaxToolProvider() { try { Thread.currentThread().getContextClassLoader().loadClass("javax.tools.ToolProvider"); return true; @@ -189,10 +238,18 @@ protected static boolean isJava16() { } public String[] createCommandLine(CompilerConfiguration config) throws CompilerException { - return buildCompilerArguments(config, getSourceFiles(config)); + final String javacVersion; + if (config.isFork()) { + String executable = getJavacExecutable(config); + javacVersion = getOutOfProcessJavacVersion(executable); + } else { + javacVersion = getInProcessJavacVersion(); + } + return buildCompilerArguments(config, getSourceFiles(config), javacVersion); } - public static String[] buildCompilerArguments(CompilerConfiguration config, String[] sourceFiles) { + public static String[] buildCompilerArguments( + CompilerConfiguration config, String[] sourceFiles, String javacVersion) { List args = new ArrayList<>(); // ---------------------------------------------------------------------- @@ -231,11 +288,11 @@ public static String[] buildCompilerArguments(CompilerConfiguration config, Stri args.add(getPathString(sourceLocations)); } - if (!isJava16() || config.isForceJavacCompilerUse() || config.isFork()) { + if (!hasJavaxToolProvider() || config.isForceJavacCompilerUse() || config.isFork()) { args.addAll(Arrays.asList(sourceFiles)); } - if (!isPreJava16(config)) { + if (JavaVersion.JAVA_1_6.isOlderOrEqualTo(javacVersion)) { // now add jdk 1.6 annotation processing related parameters if (config.getGeneratedSourcesDirectory() != null) { @@ -288,7 +345,7 @@ public static String[] buildCompilerArguments(CompilerConfiguration config, Stri args.add("-verbose"); } - if (!isPreJava18(config) && config.isParameters()) { + if (JavaVersion.JAVA_1_8.isOlderOrEqualTo(javacVersion) && config.isParameters()) { args.add("-parameters"); } @@ -338,17 +395,17 @@ public static String[] buildCompilerArguments(CompilerConfiguration config, Stri args.add(config.getTargetVersion()); } - if (!suppressSource(config) && StringUtils.isEmpty(config.getSourceVersion())) { + if (JavaVersion.JAVA_1_4.isOlderOrEqualTo(javacVersion) && StringUtils.isEmpty(config.getSourceVersion())) { // If omitted, later JDKs complain about a 1.1 target args.add("-source"); args.add("1.3"); - } else if (!suppressSource(config)) { + } else if (JavaVersion.JAVA_1_4.isOlderOrEqualTo(javacVersion)) { args.add("-source"); args.add(config.getSourceVersion()); } } - if (!suppressEncoding(config) && !StringUtils.isEmpty(config.getSourceEncoding())) { + if (JavaVersion.JAVA_1_4.isOlderOrEqualTo(javacVersion) && !StringUtils.isEmpty(config.getSourceEncoding())) { args.add("-encoding"); args.add(config.getSourceEncoding()); } @@ -384,115 +441,38 @@ public static String[] buildCompilerArguments(CompilerConfiguration config, Stri } /** - * Determine if the compiler is a version prior to 1.4. - * This is needed as 1.3 and earlier did not support -source or -encoding parameters - * - * @param config The compiler configuration to test. - * @return true if the compiler configuration represents a Java 1.4 compiler or later, false otherwise - */ - private static boolean isPreJava14(CompilerConfiguration config) { - String v = config.getCompilerVersion(); - - if (v == null) { - return false; - } - - return v.startsWith("1.3") || v.startsWith("1.2") || v.startsWith("1.1") || v.startsWith("1.0"); - } - - /** - * Determine if the compiler is a version prior to 1.6. - * This is needed for annotation processing parameters. - * - * @param config The compiler configuration to test. - * @return true if the compiler configuration represents a Java 1.6 compiler or later, false otherwise + * Represents a particular Java version (through their according version prefixes) */ - private static boolean isPreJava16(CompilerConfiguration config) { - String v = config.getReleaseVersion(); - - if (v == null) { - v = config.getCompilerVersion(); - } - - if (v == null) { - v = config.getSourceVersion(); - } - - if (v == null) { - return true; - } - - return v.startsWith("5") - || v.startsWith("1.5") - || v.startsWith("1.4") - || v.startsWith("1.3") - || v.startsWith("1.2") - || v.startsWith("1.1") - || v.startsWith("1.0"); - } - - private static boolean isPreJava18(CompilerConfiguration config) { - String v = config.getReleaseVersion(); - - if (v == null) { - v = config.getCompilerVersion(); - } - - if (v == null) { - v = config.getSourceVersion(); - } - - if (v == null) { - return true; - } - - return v.startsWith("7") - || v.startsWith("1.7") - || v.startsWith("6") - || v.startsWith("1.6") - || v.startsWith("1.5") - || v.startsWith("1.4") - || v.startsWith("1.3") - || v.startsWith("1.2") - || v.startsWith("1.1") - || v.startsWith("1.0"); - } - - private static boolean isPreJava9(CompilerConfiguration config) { - - String v = config.getReleaseVersion(); - - if (v == null) { - v = config.getCompilerVersion(); + enum JavaVersion { + JAVA_1_3_OR_OLDER("1.3", "1.2", "1.1", "1.0"), + JAVA_1_4("1.4"), + JAVA_1_5("1.5"), + JAVA_1_6("1.6"), + JAVA_1_7("1.7"), + JAVA_1_8("1.8"), + JAVA_9("9"); // since Java 9 a different versioning scheme was used (https://openjdk.org/jeps/223) + final Set versionPrefixes; + + JavaVersion(String... versionPrefixes) { + this.versionPrefixes = new HashSet<>(Arrays.asList(versionPrefixes)); } - if (v == null) { - v = config.getSourceVersion(); - } - - if (v == null) { + /** + * The internal logic checks if the given version starts with the prefix of one of the enums preceding the current one. + * + * @param version the version to check + * @return {@code true} if the version represented by this enum is older than or equal (in its minor and major version) to a given version + */ + boolean isOlderOrEqualTo(String version) { + // go through all previous enums + JavaVersion[] allJavaVersionPrefixes = JavaVersion.values(); + for (int n = ordinal() - 1; n > -1; n--) { + if (allJavaVersionPrefixes[n].versionPrefixes.stream().anyMatch(version::startsWith)) { + return false; + } + } return true; } - - return v.startsWith("8") - || v.startsWith("1.8") - || v.startsWith("7") - || v.startsWith("1.7") - || v.startsWith("1.6") - || v.startsWith("1.5") - || v.startsWith("1.4") - || v.startsWith("1.3") - || v.startsWith("1.2") - || v.startsWith("1.1") - || v.startsWith("1.0"); - } - - private static boolean suppressSource(CompilerConfiguration config) { - return isPreJava14(config); - } - - private static boolean suppressEncoding(CompilerConfiguration config) { - return isPreJava14(config); } /** @@ -925,11 +905,33 @@ private File createFileWithArguments(String[] args, String outputDirectory) thro } } + /** + * Get the path of the javac tool executable to use. + * Either given through explicit configuration or via {@link #getJavacExecutable()}. + * @param config the configuration + * @return the path of the javac tool + */ + protected String getJavacExecutable(CompilerConfiguration config) { + String executable = config.getExecutable(); + + if (StringUtils.isEmpty(executable)) { + try { + executable = getJavacExecutable(); + } catch (IOException e) { + if (getLog().isWarnEnabled()) { + getLog().warn("Unable to autodetect 'javac' path, using 'javac' from the environment."); + } + executable = "javac"; + } + } + return executable; + } + /** * Get the path of the javac tool executable: try to find it depending the OS or the java.home * system property or the JAVA_HOME environment variable. * - * @return the path of the Javadoc tool + * @return the path of the javac tool * @throws IOException if not found */ private static String getJavacExecutable() throws IOException { diff --git a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java index 9cb656a5..2dfd7a5d 100644 --- a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java +++ b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java @@ -34,12 +34,10 @@ import org.codehaus.plexus.compiler.AbstractCompilerTest; import org.codehaus.plexus.compiler.CompilerConfiguration; import org.codehaus.plexus.util.StringUtils; -import org.hamcrest.Matchers; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; /** * @author Jason van Zyl @@ -207,22 +205,19 @@ protected Collection expectedOutputFiles() { "org/codehaus/foo/ReservedWord.class"); } - protected void internalTest(CompilerConfiguration compilerConfiguration, List expectedArguments) { - internalTest(compilerConfiguration, expectedArguments, new String[0]); + protected void internalTest( + CompilerConfiguration compilerConfiguration, List expectedArguments, String javacVersion) { + internalTest(compilerConfiguration, expectedArguments, new String[0], javacVersion); } public void internalTest( - CompilerConfiguration compilerConfiguration, List expectedArguments, String[] sources) { - String[] actualArguments = JavacCompiler.buildCompilerArguments(compilerConfiguration, sources); - - assertThat( - "The expected and actual argument list sizes differ.", - actualArguments, - Matchers.arrayWithSize(expectedArguments.size())); + CompilerConfiguration compilerConfiguration, + List expectedArguments, + String[] sources, + String javacVersion) { + String[] actualArguments = JavacCompiler.buildCompilerArguments(compilerConfiguration, sources, javacVersion); - for (int i = 0; i < actualArguments.length; i++) { - assertThat("Unexpected argument", actualArguments[i], is(expectedArguments.get(i))); - } + assertArrayEquals(actualArguments, expectedArguments.toArray(new String[0])); } @Test @@ -231,11 +226,9 @@ public void testBuildCompilerArgs13() { CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); - compilerConfiguration.setCompilerVersion("1.3"); - populateArguments(compilerConfiguration, expectedArguments, true, true, false); - internalTest(compilerConfiguration, expectedArguments); + internalTest(compilerConfiguration, expectedArguments, "1.3"); } @Test @@ -244,11 +237,9 @@ public void testBuildCompilerArgs14() { CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); - compilerConfiguration.setCompilerVersion("1.4"); - populateArguments(compilerConfiguration, expectedArguments, false, false, false); - internalTest(compilerConfiguration, expectedArguments); + internalTest(compilerConfiguration, expectedArguments, "1.4"); } @Test @@ -257,11 +248,9 @@ public void testBuildCompilerArgs15() { CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); - compilerConfiguration.setCompilerVersion("1.5"); - populateArguments(compilerConfiguration, expectedArguments, false, false, false); - internalTest(compilerConfiguration, expectedArguments); + internalTest(compilerConfiguration, expectedArguments, "1.5"); } @Test @@ -270,11 +259,9 @@ public void testBuildCompilerArgs18() { CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); - compilerConfiguration.setCompilerVersion("1.8"); - populateArguments(compilerConfiguration, expectedArguments, false, false, true); - internalTest(compilerConfiguration, expectedArguments); + internalTest(compilerConfiguration, expectedArguments, "1.8"); } @Test @@ -283,9 +270,9 @@ public void testBuildCompilerArgsUnspecifiedVersion() { CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); - populateArguments(compilerConfiguration, expectedArguments, false, false, false); + populateArguments(compilerConfiguration, expectedArguments, false, false, true); - internalTest(compilerConfiguration, expectedArguments); + internalTest(compilerConfiguration, expectedArguments, "unknown"); } @Test @@ -298,9 +285,9 @@ public void testBuildCompilerDebugLevel() { compilerConfiguration.setDebugLevel("none"); - populateArguments(compilerConfiguration, expectedArguments, false, false, false); + populateArguments(compilerConfiguration, expectedArguments, false, false, true); - internalTest(compilerConfiguration, expectedArguments); + internalTest(compilerConfiguration, expectedArguments, "1.8"); } // PLXCOMP-190 @@ -334,7 +321,7 @@ public void testJRuntimeArguments() { compilerConfiguration.setCustomCompilerArgumentsAsMap(customCompilerArguments); // don't expect this argument!! - internalTest(compilerConfiguration, expectedArguments); + internalTest(compilerConfiguration, expectedArguments, "1.8"); } @Test @@ -370,7 +357,7 @@ public void testModulePathAnnotations() throws Exception { // unshared table expectedArguments.add("-XDuseUnsharedTable=true"); - internalTest(compilerConfiguration, expectedArguments, source); + internalTest(compilerConfiguration, expectedArguments, source, "11.0.1"); } @Test @@ -399,7 +386,7 @@ public void testModulePath() throws Exception { // unshared table expectedArguments.add("-XDuseUnsharedTable=true"); - internalTest(compilerConfiguration, expectedArguments); + internalTest(compilerConfiguration, expectedArguments, "11.0.1"); } @Test @@ -427,7 +414,7 @@ public void testModuleVersion() { // unshared table expectedArguments.add("-XDuseUnsharedTable=true"); - internalTest(compilerConfiguration, expectedArguments); + internalTest(compilerConfiguration, expectedArguments, "11.0.1"); } @Test @@ -449,7 +436,7 @@ public void testReleaseVersion() { // unshared table expectedArguments.add("-XDuseUnsharedTable=true"); - internalTest(compilerConfiguration, expectedArguments); + internalTest(compilerConfiguration, expectedArguments, "11.0.1"); } @Test @@ -476,7 +463,7 @@ public void testFailOnWarning() { // unshared table expectedArguments.add("-XDuseUnsharedTable=true"); - internalTest(compilerConfiguration, expectedArguments); + internalTest(compilerConfiguration, expectedArguments, "1.8"); } @Test @@ -507,7 +494,7 @@ public void testMultipleAddExports() { // unshared table expectedArguments.add("-XDuseUnsharedTable=true"); - internalTest(compilerConfiguration, expectedArguments); + internalTest(compilerConfiguration, expectedArguments, "1.8"); } /* This test fails on Java 1.4. The multiple parameters of the same source file cause an error, as it is interpreted as a DuplicateClass diff --git a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/JavacCompilerTest.java b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/JavacCompilerTest.java index 8a182fcf..3cbc4f12 100644 --- a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/JavacCompilerTest.java +++ b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/JavacCompilerTest.java @@ -7,7 +7,9 @@ import java.util.stream.Stream; import org.codehaus.plexus.compiler.CompilerMessage; +import org.codehaus.plexus.compiler.javac.JavacCompiler.JavaVersion; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -18,6 +20,9 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.notNullValue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -103,4 +108,22 @@ private static Stream testParseModernStream_withAnnotationProcessingE "JDK 21 German", "\n\nEin Annotationsprozessor hat eine nicht abgefangene Ausnahme ausgelöst.\nDetails finden Sie im folgenden Stacktrace.\n\n")); } + + @Test + void testJavaVersionPrefixes() { + assertFalse(JavaVersion.JAVA_1_4.isOlderOrEqualTo("1.3")); + assertTrue(JavaVersion.JAVA_1_4.isOlderOrEqualTo("1.4")); + assertTrue(JavaVersion.JAVA_1_4.isOlderOrEqualTo("1.4.0_something")); + assertFalse(JavaVersion.JAVA_1_5.isOlderOrEqualTo("1.4")); + assertTrue(JavaVersion.JAVA_1_8.isOlderOrEqualTo("1.8")); + assertTrue(JavaVersion.JAVA_1_8.isOlderOrEqualTo("22.0.2-something")); + assertTrue(JavaVersion.JAVA_1_8.isOlderOrEqualTo("unknown")); + } + + @Test + void testExtractMajorAndMinorVersion() { + assertEquals("11.0", JavacCompiler.extractMajorAndMinorVersion("javac 11.0.22")); + assertEquals("11.0", JavacCompiler.extractMajorAndMinorVersion("11.0.22")); + assertEquals("21", JavacCompiler.extractMajorAndMinorVersion("javac 21")); + } } diff --git a/plexus-compilers/pom.xml b/plexus-compilers/pom.xml index fcea9983..12f78ce9 100644 --- a/plexus-compilers/pom.xml +++ b/plexus-compilers/pom.xml @@ -36,6 +36,13 @@ plexus-compiler-test test + + + commons-lang + commons-lang + 2.0 + test + From d8e98dda661b2e976f5382d43bb87dea1434381f Mon Sep 17 00:00:00 2001 From: Konrad Windszus Date: Mon, 5 Feb 2024 10:44:21 +0100 Subject: [PATCH 11/20] Only use "-release" parameter with javac 9+ (#362) This closes #140 --- .../java/org/codehaus/plexus/compiler/javac/JavacCompiler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java b/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java index f7154566..2c7a9bc7 100644 --- a/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java +++ b/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java @@ -381,7 +381,7 @@ public static String[] buildCompilerArguments( args.add("-Werror"); } - if (!StringUtils.isEmpty(config.getReleaseVersion())) { + if (JavaVersion.JAVA_9.isOlderOrEqualTo(javacVersion) && !StringUtils.isEmpty(config.getReleaseVersion())) { args.add("--release"); args.add(config.getReleaseVersion()); } else { From ca3fee0a428529b7d67bc3dc1e1f53ac206b3f9d Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Sat, 17 Feb 2024 11:27:29 +0100 Subject: [PATCH 12/20] Use LocalRepositoryManager for resolving artifacts paths in tests --- plexus-compiler-test/pom.xml | 10 ---- .../plexus/compiler/AbstractCompilerTest.java | 48 ++++++++----------- pom.xml | 35 ++------------ 3 files changed, 23 insertions(+), 70 deletions(-) diff --git a/plexus-compiler-test/pom.xml b/plexus-compiler-test/pom.xml index d3f45562..36d9132f 100644 --- a/plexus-compiler-test/pom.xml +++ b/plexus-compiler-test/pom.xml @@ -43,16 +43,6 @@ maven-core ${mavenVersion} - - org.apache.maven - maven-compat - ${mavenVersion} - - - org.apache.maven - maven-settings-builder - ${mavenVersion} - org.codehaus.plexus plexus-utils diff --git a/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java b/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java index 85374c54..09ab0b6b 100644 --- a/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java +++ b/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java @@ -34,21 +34,19 @@ import java.util.Map; import java.util.stream.Collectors; +import org.apache.maven.RepositoryUtils; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.DefaultArtifact; import org.apache.maven.artifact.handler.DefaultArtifactHandler; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.DefaultArtifactRepository; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.artifact.versioning.VersionRange; -import org.apache.maven.properties.internal.SystemProperties; -import org.apache.maven.settings.Settings; -import org.apache.maven.settings.building.DefaultSettingsBuilderFactory; -import org.apache.maven.settings.building.DefaultSettingsBuildingRequest; -import org.apache.maven.settings.building.SettingsBuildingRequest; import org.codehaus.plexus.testing.PlexusTest; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.StringUtils; +import org.eclipse.aether.DefaultRepositorySystemSession; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.impl.LocalRepositoryProvider; +import org.eclipse.aether.repository.LocalRepository; +import org.eclipse.aether.repository.LocalRepositoryManager; import org.hamcrest.io.FileMatchers; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -56,6 +54,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; /** * @@ -72,34 +71,25 @@ public abstract class AbstractCompilerTest { private Map compilers; @Inject - private ArtifactRepositoryLayout repositoryLayout; + private LocalRepositoryProvider localRepositoryProvider; - private ArtifactRepository localRepository; + private LocalRepositoryManager localRepositoryManager; protected abstract String getRoleHint(); @BeforeEach final void setUpLocalRepo() throws Exception { String localRepo = System.getProperty("maven.repo.local"); + assertThat("system property maven.repo.local", localRepo, notNullValue()); - if (localRepo == null) { - File settingsFile = new File(System.getProperty("user.home"), ".m2/settings.xml"); - if (settingsFile.exists()) { - SettingsBuildingRequest request = new DefaultSettingsBuildingRequest(); - request.setUserSettingsFile(settingsFile); - request.setSystemProperties(SystemProperties.getSystemProperties()); - Settings settings = new DefaultSettingsBuilderFactory() - .newInstance() - .build(request) - .getEffectiveSettings(); - localRepo = settings.getLocalRepository(); - } - } - if (localRepo == null) { - localRepo = System.getProperty("user.home") + "/.m2/repository"; - } + LocalRepository localRepository = new LocalRepository(localRepo); + assertThat( + "test prerequisite: local repository path: " + localRepository.getBasedir(), + localRepository.getBasedir(), + FileMatchers.aReadableFile()); - localRepository = new DefaultArtifactRepository("local", "file://" + localRepo, repositoryLayout); + RepositorySystemSession session = new DefaultRepositorySystemSession(); + localRepositoryManager = localRepositoryProvider.newLocalRepositoryManager(session, localRepository); } protected void setCompilerDebug(boolean flag) { @@ -338,6 +328,8 @@ protected String getJavaVersion() { } protected File getLocalArtifactPath(Artifact artifact) { - return new File(localRepository.getBasedir(), localRepository.pathOf(artifact)); + return new File( + localRepositoryManager.getRepository().getBasedir(), + localRepositoryManager.getPathForLocalArtifact(RepositoryUtils.toArtifact(artifact))); } } diff --git a/pom.xml b/pom.xml index 13171985..b532a228 100644 --- a/pom.xml +++ b/pom.xml @@ -149,6 +149,9 @@ maven-surefire-plugin ${redirectTestOutputToFile} + + ${settings.localRepository} + @@ -206,36 +209,4 @@ - - - - maven.repo.local - - - maven.repo.local - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - - maven.repo.local - ${maven.repo.local} - - - - - - - - - From 99014e59d856078cf476a38aa0a505d82baf37af Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 21:02:01 +0000 Subject: [PATCH 13/20] Bump com.google.errorprone:error_prone_core from 2.24.1 to 2.25.0 Bumps [com.google.errorprone:error_prone_core](https://github.com/google/error-prone) from 2.24.1 to 2.25.0. - [Release notes](https://github.com/google/error-prone/releases) - [Commits](https://github.com/google/error-prone/compare/v2.24.1...v2.25.0) --- updated-dependencies: - dependency-name: com.google.errorprone:error_prone_core dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b532a228..5e2b5e02 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ 1.9.21 3.6.3 ${mavenVersion} - 2.24.1 + 2.25.0 false clean install 3.12.1 From 224825502534bb90701c1b5eb5443982f75edf11 Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Thu, 22 Feb 2024 00:33:07 +0700 Subject: [PATCH 14/20] Lazy providers and better error reporting (#361) * ITs need plugin dependency to plexus-compiler-manager While testing #347, changes in compiler manager were not pulled into ITs, because Maven Compiler has a dependency on it, which must be overridden in all ITs or in projects using Plexus Compiler generally, if they need to override the version predefined by Maven Compiler. * Lazy providers and better error reporting If scanning, injection or construction fails, log a comprehensive error message on top of throwing a NoSuchCompilerException. Fixes #347. Co-authored-by: Alexander Kriegisch * Code review: throw exception with cause In order to be able to do that at all, I had to add a constructor taking a throwable first. Now, even though a cause is propagated, at the time of writing this Maven Compiler will just catch the NoSuchCompilerException we throw, ignore its message and root cause and throw a new MojoExecutionException instead. :-/ Relates to #347. * Code review: improve DefaultCompilerManager.ERROR_MESSAGE Add more detail concerning possible user errors like misspelling the compiler ID or missing dependencies for a compiler. Relates to #347. --------- Co-authored-by: Tamas Cservenak --- .../src/main/it/MCOMPILER-346-mre/pom.xml | 5 ++++ .../src/main/it/aspectj-compiler/pom.xml | 5 ++++ .../it/eclipse-compiler-mapstruct/pom.xml | 5 ++++ .../main/it/eclipse-compiler-procpath/pom.xml | 5 ++++ .../src/main/it/error-prone-compiler/pom.xml | 5 ++++ .../src/main/it/missing-warnings/pom.xml | 7 ++++- .../it/simple-eclipse-compiler-fail/pom.xml | 5 ++++ .../main/it/simple-eclipse-compiler/pom.xml | 5 ++++ .../src/main/it/simple-javac-fork/pom.xml | 5 ++++ .../src/main/it/simple-javac/pom.xml | 5 ++++ .../manager/DefaultCompilerManager.java | 30 ++++++++++++++++--- .../manager/NoSuchCompilerException.java | 5 +++- 12 files changed, 81 insertions(+), 6 deletions(-) diff --git a/plexus-compiler-its/src/main/it/MCOMPILER-346-mre/pom.xml b/plexus-compiler-its/src/main/it/MCOMPILER-346-mre/pom.xml index c8a739f3..661cafa8 100644 --- a/plexus-compiler-its/src/main/it/MCOMPILER-346-mre/pom.xml +++ b/plexus-compiler-its/src/main/it/MCOMPILER-346-mre/pom.xml @@ -64,6 +64,11 @@ plexus-compiler-api ${plexus.compiler.version} + + org.codehaus.plexus + plexus-compiler-manager + ${plexus.compiler.version} + org.codehaus.plexus plexus-compiler-javac diff --git a/plexus-compiler-its/src/main/it/aspectj-compiler/pom.xml b/plexus-compiler-its/src/main/it/aspectj-compiler/pom.xml index 4638fbcb..f9c68382 100644 --- a/plexus-compiler-its/src/main/it/aspectj-compiler/pom.xml +++ b/plexus-compiler-its/src/main/it/aspectj-compiler/pom.xml @@ -48,6 +48,11 @@ plexus-compiler-api ${plexus.compiler.version} + + org.codehaus.plexus + plexus-compiler-manager + ${plexus.compiler.version} + org.codehaus.plexus plexus-compiler-aspectj 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 6ffa414e..77c88a83 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 @@ -59,6 +59,11 @@ plexus-compiler-api ${plexus.compiler.version} + + org.codehaus.plexus + plexus-compiler-manager + ${plexus.compiler.version} + org.codehaus.plexus plexus-compiler-eclipse 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 index c23ec93b..b3238814 100644 --- a/plexus-compiler-its/src/main/it/eclipse-compiler-procpath/pom.xml +++ b/plexus-compiler-its/src/main/it/eclipse-compiler-procpath/pom.xml @@ -66,6 +66,11 @@ plexus-compiler-api ${plexus.compiler.version} + + org.codehaus.plexus + plexus-compiler-manager + ${plexus.compiler.version} + org.codehaus.plexus plexus-compiler-eclipse diff --git a/plexus-compiler-its/src/main/it/error-prone-compiler/pom.xml b/plexus-compiler-its/src/main/it/error-prone-compiler/pom.xml index 1a63924f..87f7947f 100644 --- a/plexus-compiler-its/src/main/it/error-prone-compiler/pom.xml +++ b/plexus-compiler-its/src/main/it/error-prone-compiler/pom.xml @@ -83,6 +83,11 @@ plexus-compiler-api ${plexus.compiler.version} + + org.codehaus.plexus + plexus-compiler-manager + ${plexus.compiler.version} + org.codehaus.plexus plexus-compiler-javac-errorprone diff --git a/plexus-compiler-its/src/main/it/missing-warnings/pom.xml b/plexus-compiler-its/src/main/it/missing-warnings/pom.xml index 42af0b33..81200739 100644 --- a/plexus-compiler-its/src/main/it/missing-warnings/pom.xml +++ b/plexus-compiler-its/src/main/it/missing-warnings/pom.xml @@ -25,6 +25,11 @@ plexus-compiler-api ${plexus.compiler.version} + + org.codehaus.plexus + plexus-compiler-manager + ${plexus.compiler.version} + org.codehaus.plexus plexus-compiler-javac @@ -42,4 +47,4 @@ UTF-8 @pom.version@ - \ No newline at end of file + diff --git a/plexus-compiler-its/src/main/it/simple-eclipse-compiler-fail/pom.xml b/plexus-compiler-its/src/main/it/simple-eclipse-compiler-fail/pom.xml index 03a77f48..d8a2ce41 100644 --- a/plexus-compiler-its/src/main/it/simple-eclipse-compiler-fail/pom.xml +++ b/plexus-compiler-its/src/main/it/simple-eclipse-compiler-fail/pom.xml @@ -61,6 +61,11 @@ plexus-compiler-api ${plexus.compiler.version} + + org.codehaus.plexus + plexus-compiler-manager + ${plexus.compiler.version} + org.codehaus.plexus plexus-compiler-eclipse diff --git a/plexus-compiler-its/src/main/it/simple-eclipse-compiler/pom.xml b/plexus-compiler-its/src/main/it/simple-eclipse-compiler/pom.xml index 54694e38..365df38a 100644 --- a/plexus-compiler-its/src/main/it/simple-eclipse-compiler/pom.xml +++ b/plexus-compiler-its/src/main/it/simple-eclipse-compiler/pom.xml @@ -61,6 +61,11 @@ plexus-compiler-api ${plexus.compiler.version} + + org.codehaus.plexus + plexus-compiler-manager + ${plexus.compiler.version} + org.codehaus.plexus plexus-compiler-eclipse diff --git a/plexus-compiler-its/src/main/it/simple-javac-fork/pom.xml b/plexus-compiler-its/src/main/it/simple-javac-fork/pom.xml index 2ed55a79..2e654657 100644 --- a/plexus-compiler-its/src/main/it/simple-javac-fork/pom.xml +++ b/plexus-compiler-its/src/main/it/simple-javac-fork/pom.xml @@ -63,6 +63,11 @@ plexus-compiler-api ${plexus.compiler.version} + + org.codehaus.plexus + plexus-compiler-manager + ${plexus.compiler.version} + org.codehaus.plexus plexus-compiler-javac diff --git a/plexus-compiler-its/src/main/it/simple-javac/pom.xml b/plexus-compiler-its/src/main/it/simple-javac/pom.xml index a400f268..ca0f36d7 100644 --- a/plexus-compiler-its/src/main/it/simple-javac/pom.xml +++ b/plexus-compiler-its/src/main/it/simple-javac/pom.xml @@ -63,6 +63,11 @@ plexus-compiler-api ${plexus.compiler.version} + + org.codehaus.plexus + plexus-compiler-manager + ${plexus.compiler.version} + org.codehaus.plexus plexus-compiler-javac diff --git a/plexus-compiler-manager/src/main/java/org/codehaus/plexus/compiler/manager/DefaultCompilerManager.java b/plexus-compiler-manager/src/main/java/org/codehaus/plexus/compiler/manager/DefaultCompilerManager.java index 29af62f7..b8024a22 100644 --- a/plexus-compiler-manager/src/main/java/org/codehaus/plexus/compiler/manager/DefaultCompilerManager.java +++ b/plexus-compiler-manager/src/main/java/org/codehaus/plexus/compiler/manager/DefaultCompilerManager.java @@ -25,30 +25,52 @@ */ import javax.inject.Inject; import javax.inject.Named; +import javax.inject.Provider; import java.util.Map; import org.codehaus.plexus.compiler.Compiler; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author Trygve Laugstøl */ @Named public class DefaultCompilerManager implements CompilerManager { + private static final String ERROR_MESSAGE = "Compiler '{}' could not be instantiated or injected properly. " + + "If you spelled the compiler ID correctly and all necessary dependencies are on the classpath, " + + "then next you can try running the build with -Dsisu.debug, looking for exceptions."; + private static final String ERROR_MESSAGE_DETAIL = "TypeNotPresentException caused by UnsupportedClassVersionError " + + "might indicate, that the compiler needs a more recent Java runtime. " + + "IllegalArgumentException in ClassReader. might mean, that you need to upgrade Maven."; + @Inject - private Map compilers; + private Map> compilers; + + private final Logger log = LoggerFactory.getLogger(getClass()); // ---------------------------------------------------------------------- // CompilerManager Implementation // ---------------------------------------------------------------------- public Compiler getCompiler(String compilerId) throws NoSuchCompilerException { - Compiler compiler = compilers.get(compilerId); + // Provider is lazy -> presence of provider means compiler is present, but not yet constructed + Provider compilerProvider = compilers.get(compilerId); - if (compiler == null) { + if (compilerProvider == null) { + // Compiler could not be injected for some reason + log.error(ERROR_MESSAGE + " " + ERROR_MESSAGE_DETAIL, compilerId); throw new NoSuchCompilerException(compilerId); } - return compiler; + // Provider exists, but compiler was not created yet + try { + return compilerProvider.get(); + } catch (Exception e) { + // DI could not construct compiler + log.error(ERROR_MESSAGE, compilerId); + throw new NoSuchCompilerException(compilerId, e); + } } } diff --git a/plexus-compiler-manager/src/main/java/org/codehaus/plexus/compiler/manager/NoSuchCompilerException.java b/plexus-compiler-manager/src/main/java/org/codehaus/plexus/compiler/manager/NoSuchCompilerException.java index e40c6462..135f0950 100644 --- a/plexus-compiler-manager/src/main/java/org/codehaus/plexus/compiler/manager/NoSuchCompilerException.java +++ b/plexus-compiler-manager/src/main/java/org/codehaus/plexus/compiler/manager/NoSuchCompilerException.java @@ -31,8 +31,11 @@ public class NoSuchCompilerException extends Exception { private final String compilerId; public NoSuchCompilerException(String compilerId) { - super("No such compiler '" + compilerId + "'."); + this(compilerId, null); + } + public NoSuchCompilerException(String compilerId, Throwable cause) { + super("No such compiler '" + compilerId + "'", cause); this.compilerId = compilerId; } From 57dfc26b40d74b8d175008be2ce21eb54a0a8d69 Mon Sep 17 00:00:00 2001 From: Sylwester Lachiewicz Date: Thu, 22 Feb 2024 23:01:39 +0100 Subject: [PATCH 15/20] Path.relativize() may throw exception if source and build directories are on different Windows drives Closes #364 --- .../plexus/compiler/AbstractCompiler.java | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/AbstractCompiler.java b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/AbstractCompiler.java index 7a3a4a52..0acb4694 100644 --- a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/AbstractCompiler.java +++ b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/AbstractCompiler.java @@ -268,19 +268,31 @@ private static String getCanonicalPath(File origFile) throws CompilerException { protected void logCompiling(String[] sourceFiles, CompilerConfiguration config) { if (log.isInfoEnabled()) { - String to = (config.getWorkingDirectory() == null) - ? config.getOutputLocation() - : config.getWorkingDirectory() - .toPath() - .relativize(new File(config.getOutputLocation()).toPath()) - .toString(); log.info("Compiling " + (sourceFiles == null ? "" : (sourceFiles.length + " source file" + (sourceFiles.length == 1 ? " " : "s "))) + "with " + getCompilerId() + " [" + config.describe() + "]" + " to " - + to); + + getRelativeWorkingDirectory(config)); } } + + private static String getRelativeWorkingDirectory(CompilerConfiguration config) { + String to; + if (config.getWorkingDirectory() == null) { + to = config.getOutputLocation(); + } else { + try { + to = config.getWorkingDirectory() + .toPath() + .relativize(new File(config.getOutputLocation()).toPath()) + .toString(); + } catch (IllegalArgumentException e) { + // may happen on Windows if the working directory is on a different drive + to = config.getOutputLocation(); + } + } + return to; + } } From 527ebf83f08449cf486a3d035e6e5510a9a8ea62 Mon Sep 17 00:00:00 2001 From: Sylwester Lachiewicz Date: Thu, 22 Feb 2024 23:21:26 +0100 Subject: [PATCH 16/20] Cleanup dependencies Closes #355 --- plexus-compiler-manager/pom.xml | 4 ++++ plexus-compiler-test/pom.xml | 4 ++++ plexus-compilers/plexus-compiler-aspectj/pom.xml | 4 ++++ plexus-compilers/plexus-compiler-csharp/pom.xml | 5 ----- plexus-compilers/plexus-compiler-eclipse/pom.xml | 11 +++-------- .../plexus-compiler-javac-errorprone/pom.xml | 4 ---- plexus-compilers/plexus-compiler-javac/pom.xml | 5 ++--- pom.xml | 5 +++++ 8 files changed, 22 insertions(+), 20 deletions(-) diff --git a/plexus-compiler-manager/pom.xml b/plexus-compiler-manager/pom.xml index f1576a36..b7e40097 100644 --- a/plexus-compiler-manager/pom.xml +++ b/plexus-compiler-manager/pom.xml @@ -21,6 +21,10 @@ javax.inject javax.inject + + org.slf4j + slf4j-api + org.codehaus.plexus plexus-xml diff --git a/plexus-compiler-test/pom.xml b/plexus-compiler-test/pom.xml index 36d9132f..888e39d1 100644 --- a/plexus-compiler-test/pom.xml +++ b/plexus-compiler-test/pom.xml @@ -13,6 +13,10 @@ Plexus Compiler Test Harness + + javax.inject + javax.inject + org.codehaus.plexus plexus-compiler-api diff --git a/plexus-compilers/plexus-compiler-aspectj/pom.xml b/plexus-compilers/plexus-compiler-aspectj/pom.xml index 38681fc4..2a7ff75c 100644 --- a/plexus-compilers/plexus-compiler-aspectj/pom.xml +++ b/plexus-compilers/plexus-compiler-aspectj/pom.xml @@ -32,6 +32,10 @@ aspectjtools ${aspectj.version} + + org.codehaus.plexus + plexus-utils + diff --git a/plexus-compilers/plexus-compiler-csharp/pom.xml b/plexus-compilers/plexus-compiler-csharp/pom.xml index 495785f0..83b111f0 100644 --- a/plexus-compilers/plexus-compiler-csharp/pom.xml +++ b/plexus-compilers/plexus-compiler-csharp/pom.xml @@ -22,11 +22,6 @@ org.codehaus.plexus plexus-utils - - org.junit.jupiter - junit-jupiter-api - test - org.hamcrest hamcrest diff --git a/plexus-compilers/plexus-compiler-eclipse/pom.xml b/plexus-compilers/plexus-compiler-eclipse/pom.xml index 5017ceab..b663d40e 100644 --- a/plexus-compilers/plexus-compiler-eclipse/pom.xml +++ b/plexus-compilers/plexus-compiler-eclipse/pom.xml @@ -18,10 +18,6 @@ - - org.codehaus.plexus - plexus-compiler-api - org.codehaus.plexus plexus-utils @@ -36,9 +32,8 @@ javax.inject - org.junit.jupiter - junit-jupiter-api - test + org.slf4j + slf4j-api org.junit.jupiter @@ -53,7 +48,7 @@ org.codehaus.plexus plexus-testing - compile + test diff --git a/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml b/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml index aa951fb4..6df8c48c 100644 --- a/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml +++ b/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml @@ -20,10 +20,6 @@ - - org.codehaus.plexus - plexus-utils - org.codehaus.plexus plexus-compiler-javac diff --git a/plexus-compilers/plexus-compiler-javac/pom.xml b/plexus-compilers/plexus-compiler-javac/pom.xml index 63ac8b57..5419880b 100644 --- a/plexus-compilers/plexus-compiler-javac/pom.xml +++ b/plexus-compilers/plexus-compiler-javac/pom.xml @@ -23,9 +23,8 @@ javax.inject - org.junit.jupiter - junit-jupiter-api - test + org.slf4j + slf4j-api org.junit.jupiter diff --git a/pom.xml b/pom.xml index 5e2b5e02..4f6f9390 100644 --- a/pom.xml +++ b/pom.xml @@ -138,6 +138,11 @@ plexus-xml 3.0.0 + + org.slf4j + slf4j-api + 1.7.36 + From 4a37bfdc9d39795ea6a3e0dd3075574d758931d9 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Sat, 24 Feb 2024 13:56:10 +0100 Subject: [PATCH 17/20] Bump project version to 2.15.0-SNAPSHOT --- plexus-compiler-api/pom.xml | 2 +- plexus-compiler-its/pom.xml | 6 +++++- plexus-compiler-manager/pom.xml | 2 +- plexus-compiler-test/pom.xml | 2 +- plexus-compilers/plexus-compiler-aspectj/pom.xml | 2 +- plexus-compilers/plexus-compiler-csharp/pom.xml | 2 +- plexus-compilers/plexus-compiler-eclipse/pom.xml | 2 +- .../plexus-compiler-javac-errorprone/pom.xml | 2 +- plexus-compilers/plexus-compiler-javac/pom.xml | 2 +- plexus-compilers/pom.xml | 2 +- pom.xml | 9 +++++++-- 11 files changed, 21 insertions(+), 12 deletions(-) diff --git a/plexus-compiler-api/pom.xml b/plexus-compiler-api/pom.xml index d67915b0..5b4f5849 100644 --- a/plexus-compiler-api/pom.xml +++ b/plexus-compiler-api/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compiler - 2.14.3-SNAPSHOT + 2.15.0-SNAPSHOT plexus-compiler-api diff --git a/plexus-compiler-its/pom.xml b/plexus-compiler-its/pom.xml index 1264cec5..8ad8e283 100644 --- a/plexus-compiler-its/pom.xml +++ b/plexus-compiler-its/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compiler - 2.14.3-SNAPSHOT + 2.15.0-SNAPSHOT plexus-compiler-its @@ -36,6 +36,10 @@ org.codehaus.plexus plexus-compiler-javac-errorprone + + org.codehaus.plexus + plexus-compiler-manager + diff --git a/plexus-compiler-manager/pom.xml b/plexus-compiler-manager/pom.xml index b7e40097..77a666c8 100644 --- a/plexus-compiler-manager/pom.xml +++ b/plexus-compiler-manager/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compiler - 2.14.3-SNAPSHOT + 2.15.0-SNAPSHOT plexus-compiler-manager diff --git a/plexus-compiler-test/pom.xml b/plexus-compiler-test/pom.xml index 888e39d1..b27b0737 100644 --- a/plexus-compiler-test/pom.xml +++ b/plexus-compiler-test/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compiler - 2.14.3-SNAPSHOT + 2.15.0-SNAPSHOT plexus-compiler-test diff --git a/plexus-compilers/plexus-compiler-aspectj/pom.xml b/plexus-compilers/plexus-compiler-aspectj/pom.xml index 2a7ff75c..2dae9434 100644 --- a/plexus-compilers/plexus-compiler-aspectj/pom.xml +++ b/plexus-compilers/plexus-compiler-aspectj/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compilers - 2.14.3-SNAPSHOT + 2.15.0-SNAPSHOT plexus-compiler-aspectj diff --git a/plexus-compilers/plexus-compiler-csharp/pom.xml b/plexus-compilers/plexus-compiler-csharp/pom.xml index 83b111f0..2d42429d 100644 --- a/plexus-compilers/plexus-compiler-csharp/pom.xml +++ b/plexus-compilers/plexus-compiler-csharp/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compilers - 2.14.3-SNAPSHOT + 2.15.0-SNAPSHOT plexus-compiler-csharp diff --git a/plexus-compilers/plexus-compiler-eclipse/pom.xml b/plexus-compilers/plexus-compiler-eclipse/pom.xml index b663d40e..bc7a0731 100644 --- a/plexus-compilers/plexus-compiler-eclipse/pom.xml +++ b/plexus-compilers/plexus-compiler-eclipse/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compilers - 2.14.3-SNAPSHOT + 2.15.0-SNAPSHOT plexus-compiler-eclipse diff --git a/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml b/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml index 6df8c48c..9c8ea18f 100644 --- a/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml +++ b/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compilers - 2.14.3-SNAPSHOT + 2.15.0-SNAPSHOT plexus-compiler-javac-errorprone diff --git a/plexus-compilers/plexus-compiler-javac/pom.xml b/plexus-compilers/plexus-compiler-javac/pom.xml index 5419880b..57d9309f 100644 --- a/plexus-compilers/plexus-compiler-javac/pom.xml +++ b/plexus-compilers/plexus-compiler-javac/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compilers - 2.14.3-SNAPSHOT + 2.15.0-SNAPSHOT plexus-compiler-javac diff --git a/plexus-compilers/pom.xml b/plexus-compilers/pom.xml index 12f78ce9..d543e204 100644 --- a/plexus-compilers/pom.xml +++ b/plexus-compilers/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compiler - 2.14.3-SNAPSHOT + 2.15.0-SNAPSHOT plexus-compilers diff --git a/pom.xml b/pom.xml index 4f6f9390..0e3bd45c 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ plexus-compiler - 2.14.3-SNAPSHOT + 2.15.0-SNAPSHOT pom Plexus Compiler @@ -44,7 +44,7 @@ scm:git:git@github.com:codehaus-plexus/plexus-compiler.git 8 true - 2023-12-20T20:25:35Z + 2024-02-24T12:54:17Z 1.9.21 3.6.3 ${mavenVersion} @@ -86,6 +86,11 @@ plexus-compiler-javac ${project.version} + + org.codehaus.plexus + plexus-compiler-manager + ${project.version} + org.codehaus.plexus plexus-component-annotations From e9ae6e7e79a2d1aff1515d47e2dc03c4e152fc1a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 21:36:04 +0000 Subject: [PATCH 18/20] Bump org.codehaus.plexus:plexus from 16 to 17 Bumps [org.codehaus.plexus:plexus](https://github.com/codehaus-plexus/plexus-pom) from 16 to 17. - [Release notes](https://github.com/codehaus-plexus/plexus-pom/releases) - [Commits](https://github.com/codehaus-plexus/plexus-pom/commits) --- updated-dependencies: - dependency-name: org.codehaus.plexus:plexus dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0e3bd45c..a5cf8d6f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus - 16 + 17 plexus-compiler From 32cfc65ba1bfe1e3189c070e275b615c96f98107 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Thu, 7 Mar 2024 19:38:10 +0100 Subject: [PATCH 19/20] Allow to override useUnsharedTable compiler argument fix #371 --- .../plexus/compiler/javac/JavacCompiler.java | 2 +- .../javac/AbstractJavacCompilerTest.java | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java b/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java index 2c7a9bc7..f25e099b 100644 --- a/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java +++ b/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java @@ -433,7 +433,7 @@ public static String[] buildCompilerArguments( args.add(value); } - if (!config.isFork()) { + if (!config.isFork() && !args.contains("-XDuseUnsharedTable=false")) { args.add("-XDuseUnsharedTable=true"); } diff --git a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java index 2dfd7a5d..a91ebd8c 100644 --- a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java +++ b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java @@ -497,6 +497,29 @@ public void testMultipleAddExports() { internalTest(compilerConfiguration, expectedArguments, "1.8"); } + @Test + public void testWithGivenUnsharedTable() { + List expectedArguments = new ArrayList<>(); + + CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); + + // outputLocation + compilerConfiguration.setOutputLocation("/output"); + expectedArguments.add("-d"); + expectedArguments.add(new File("/output").getAbsolutePath()); + + // releaseVersion + compilerConfiguration.setReleaseVersion("6"); + expectedArguments.add("--release"); + expectedArguments.add("6"); + + // unshared table + compilerConfiguration.addCompilerCustomArgument("-XDuseUnsharedTable=false", null); + expectedArguments.add("-XDuseUnsharedTable=false"); + + internalTest(compilerConfiguration, expectedArguments, "11.0.1"); + } + /* This test fails on Java 1.4. The multiple parameters of the same source file cause an error, as it is interpreted as a DuplicateClass * Setting the size of the array to 3 is fine, but does not exactly test what it is supposed to - disabling the test for now public void testCommandLineTooLongWhenForking() From 999c9659411ab82b5c073dd89446cf880e8d289e Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Sun, 10 Mar 2024 17:45:05 +0100 Subject: [PATCH 20/20] [maven-release-plugin] prepare release plexus-compiler-2.15.0 --- plexus-compiler-api/pom.xml | 2 +- plexus-compiler-its/pom.xml | 2 +- plexus-compiler-manager/pom.xml | 2 +- plexus-compiler-test/pom.xml | 2 +- plexus-compilers/plexus-compiler-aspectj/pom.xml | 2 +- plexus-compilers/plexus-compiler-csharp/pom.xml | 2 +- plexus-compilers/plexus-compiler-eclipse/pom.xml | 2 +- plexus-compilers/plexus-compiler-javac-errorprone/pom.xml | 2 +- plexus-compilers/plexus-compiler-javac/pom.xml | 2 +- plexus-compilers/pom.xml | 2 +- pom.xml | 6 +++--- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/plexus-compiler-api/pom.xml b/plexus-compiler-api/pom.xml index 5b4f5849..a51f98d8 100644 --- a/plexus-compiler-api/pom.xml +++ b/plexus-compiler-api/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compiler - 2.15.0-SNAPSHOT + 2.15.0 plexus-compiler-api diff --git a/plexus-compiler-its/pom.xml b/plexus-compiler-its/pom.xml index 8ad8e283..387dd83b 100644 --- a/plexus-compiler-its/pom.xml +++ b/plexus-compiler-its/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compiler - 2.15.0-SNAPSHOT + 2.15.0 plexus-compiler-its diff --git a/plexus-compiler-manager/pom.xml b/plexus-compiler-manager/pom.xml index 77a666c8..efc953b3 100644 --- a/plexus-compiler-manager/pom.xml +++ b/plexus-compiler-manager/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compiler - 2.15.0-SNAPSHOT + 2.15.0 plexus-compiler-manager diff --git a/plexus-compiler-test/pom.xml b/plexus-compiler-test/pom.xml index b27b0737..01fb72d3 100644 --- a/plexus-compiler-test/pom.xml +++ b/plexus-compiler-test/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compiler - 2.15.0-SNAPSHOT + 2.15.0 plexus-compiler-test diff --git a/plexus-compilers/plexus-compiler-aspectj/pom.xml b/plexus-compilers/plexus-compiler-aspectj/pom.xml index 2dae9434..4a4e12fd 100644 --- a/plexus-compilers/plexus-compiler-aspectj/pom.xml +++ b/plexus-compilers/plexus-compiler-aspectj/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compilers - 2.15.0-SNAPSHOT + 2.15.0 plexus-compiler-aspectj diff --git a/plexus-compilers/plexus-compiler-csharp/pom.xml b/plexus-compilers/plexus-compiler-csharp/pom.xml index 2d42429d..e3c34baa 100644 --- a/plexus-compilers/plexus-compiler-csharp/pom.xml +++ b/plexus-compilers/plexus-compiler-csharp/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compilers - 2.15.0-SNAPSHOT + 2.15.0 plexus-compiler-csharp diff --git a/plexus-compilers/plexus-compiler-eclipse/pom.xml b/plexus-compilers/plexus-compiler-eclipse/pom.xml index bc7a0731..50388318 100644 --- a/plexus-compilers/plexus-compiler-eclipse/pom.xml +++ b/plexus-compilers/plexus-compiler-eclipse/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compilers - 2.15.0-SNAPSHOT + 2.15.0 plexus-compiler-eclipse diff --git a/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml b/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml index 9c8ea18f..54a67bee 100644 --- a/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml +++ b/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compilers - 2.15.0-SNAPSHOT + 2.15.0 plexus-compiler-javac-errorprone diff --git a/plexus-compilers/plexus-compiler-javac/pom.xml b/plexus-compilers/plexus-compiler-javac/pom.xml index 57d9309f..43d4ae83 100644 --- a/plexus-compilers/plexus-compiler-javac/pom.xml +++ b/plexus-compilers/plexus-compiler-javac/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compilers - 2.15.0-SNAPSHOT + 2.15.0 plexus-compiler-javac diff --git a/plexus-compilers/pom.xml b/plexus-compilers/pom.xml index d543e204..d60cafd6 100644 --- a/plexus-compilers/pom.xml +++ b/plexus-compilers/pom.xml @@ -5,7 +5,7 @@ org.codehaus.plexus plexus-compiler - 2.15.0-SNAPSHOT + 2.15.0 plexus-compilers diff --git a/pom.xml b/pom.xml index a5cf8d6f..709cc4df 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ plexus-compiler - 2.15.0-SNAPSHOT + 2.15.0 pom Plexus Compiler @@ -26,7 +26,7 @@ ${scm.url} ${scm.url} - HEAD + plexus-compiler-2.15.0 http://github.com/codehaus-plexus/plexus-compiler/tree/${project.scm.tag}/ @@ -44,7 +44,7 @@ scm:git:git@github.com:codehaus-plexus/plexus-compiler.git 8 true - 2024-02-24T12:54:17Z + 2024-03-10T16:44:32Z 1.9.21 3.6.3 ${mavenVersion}