This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 477fc0de Fix automodules-manifest IT and combine the mcompiler-21 ITs
477fc0de is described below
commit 477fc0de79be28fd14fee1f670d1558016f8d014
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Wed Nov 4 21:00:21 2026 +0000
Fix automodules-manifest IT and combine the mcompiler-21 ITs
automodules-manifest asserted the absence of a message the plugin no longer
prints, so it could not fail; it now checks the current text and that the
module path was used. mcompiler-21_class-remove and
mcompiler-21_methodname-change differed only in the source change; they are one
IT with three steps.
Fixes #1201
---
src/it/automodules-manifest/verify.groovy | 8 ++-
.../mcompiler-21_class-remove/invoker.properties | 21 -------
src/it/mcompiler-21_class-remove/pom.xml | 69 ----------------------
src/it/mcompiler-21_class-remove/verify.groovy | 23 --------
.../invoker.properties | 7 ++-
.../pom.xml | 56 ++++++++++++------
.../src/main/java/BeanA.java | 0
.../src/main/java/BeanA2.java | 0
.../verify.groovy | 7 +--
.../src/main/java/BeanA.java | 35 -----------
.../src/main/java/BeanA2.java | 36 -----------
11 files changed, 52 insertions(+), 210 deletions(-)
diff --git a/src/it/automodules-manifest/verify.groovy
b/src/it/automodules-manifest/verify.groovy
index 51ff08ee..9ce91f88 100644
--- a/src/it/automodules-manifest/verify.groovy
+++ b/src/it/automodules-manifest/verify.groovy
@@ -17,6 +17,10 @@
* under the License.
*/
-buildLog = new File( basedir, 'build.log' ).text;
+def buildLog = new File(basedir, 'build.log').text
-assert !buildLog.contains("] Required automodules detected. Please don't
publish this project to a public artifact repository!");
+// the jar names its module in the manifest and is resolved from the module
path
+assert buildLog.contains('with javac [debug release 9 module-path]')
+assert buildLog =~ /--module-path \S*ta3-3\.0-SNAPSHOT\.jar/
+
+assert !buildLog.contains('Required filename-based automodules detected')
diff --git a/src/it/mcompiler-21_class-remove/invoker.properties
b/src/it/mcompiler-21_class-remove/invoker.properties
deleted file mode 100644
index 8511bf01..00000000
--- a/src/it/mcompiler-21_class-remove/invoker.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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.goals = clean compile
-invoker.goals.2 = org.codehaus.gmaven:groovy-maven-plugin:execute
-invoker.goals.3 = compile
-invoker.buildResult.3 = failure
diff --git a/src/it/mcompiler-21_class-remove/pom.xml
b/src/it/mcompiler-21_class-remove/pom.xml
deleted file mode 100644
index bcb5979b..00000000
--- a/src/it/mcompiler-21_class-remove/pom.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-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.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.maven.plugins.compiler.it</groupId>
- <artifactId>mcompiler-21_class-remove</artifactId>
- <version>1.0-SNAPSHOT</version>
-
- <description>
- This IT tests what happens if a single class BeanA is removed.
- In this case 'mvn compile' (without a clean) should fail as BeanA2
- still uses the removed class BeanA.
- </description>
-
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>@project.version@</version>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <!-- Called as second invoker goal to simulate file adjustment -->
- <groupId>org.codehaus.gmaven</groupId>
- <artifactId>groovy-maven-plugin</artifactId>
- <version>2.1.1</version>
- <configuration>
- <source>
- def beanAFile = new File( project.basedir,
'src/main/java/BeanA.java' )
-
- beanAFile.delete()
- </source>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-all</artifactId>
- <version>2.4.21</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/src/it/mcompiler-21_class-remove/verify.groovy
b/src/it/mcompiler-21_class-remove/verify.groovy
deleted file mode 100644
index 3e4f8d17..00000000
--- a/src/it/mcompiler-21_class-remove/verify.groovy
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 logFile = new File( basedir, 'build.log' )
-assert logFile.exists()
-content = logFile.text
-
-assert content.contains( 'COMPILATION ERROR :' )
diff --git a/src/it/mcompiler-21_methodname-change/invoker.properties
b/src/it/mcompiler-21_incremental-source-change/invoker.properties
similarity index 78%
rename from src/it/mcompiler-21_methodname-change/invoker.properties
rename to src/it/mcompiler-21_incremental-source-change/invoker.properties
index 8511bf01..3d56f595 100644
--- a/src/it/mcompiler-21_methodname-change/invoker.properties
+++ b/src/it/mcompiler-21_incremental-source-change/invoker.properties
@@ -16,6 +16,11 @@
# under the License.
invoker.goals = clean compile
-invoker.goals.2 = org.codehaus.gmaven:groovy-maven-plugin:execute
+invoker.goals.2 = org.codehaus.gmaven:groovy-maven-plugin:execute@rename-method
invoker.goals.3 = compile
invoker.buildResult.3 = failure
+invoker.goals.4 =
org.codehaus.gmaven:groovy-maven-plugin:execute@restore-method
+invoker.goals.5 = compile
+invoker.goals.6 = org.codehaus.gmaven:groovy-maven-plugin:execute@remove-class
+invoker.goals.7 = compile
+invoker.buildResult.7 = failure
diff --git a/src/it/mcompiler-21_methodname-change/pom.xml
b/src/it/mcompiler-21_incremental-source-change/pom.xml
similarity index 54%
rename from src/it/mcompiler-21_methodname-change/pom.xml
rename to src/it/mcompiler-21_incremental-source-change/pom.xml
index 90569024..f3b72a44 100644
--- a/src/it/mcompiler-21_methodname-change/pom.xml
+++ b/src/it/mcompiler-21_incremental-source-change/pom.xml
@@ -24,13 +24,13 @@ under the License.
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.plugins.compiler.it</groupId>
- <artifactId>mcompiler-21_methodname-change</artifactId>
+ <artifactId>mcompiler-21_incremental-source-change</artifactId>
<version>1.0-SNAPSHOT</version>
<description>
- This IT tests what happens if the method name in a single class BeanA gets
changed.
- In this case 'mvn compile' (without a clean) should fail as BeanA2
- still uses the old method of BeanA.
+ This IT tests what happens if a source file changes between two builds
without a clean.
+ First the method getI() of BeanA is renamed, then renamed back, then the
class BeanA is removed.
+ In both incompatible cases 'mvn compile' should fail as BeanA2 still uses
the old method and the removed class.
</description>
<build>
@@ -45,24 +45,42 @@ under the License.
</pluginManagement>
<plugins>
<plugin>
- <!-- Called as second invoker goal to simulate file adjustment -->
+ <!-- Called as separate invoker goals to simulate file adjustments
between the builds -->
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<version>2.1.1</version>
- <configuration>
- <source>
- def beanAFile = new File( project.basedir,
'src/main/java/BeanA.java' )
-
- processFileInplace( beanAFile ) { text ->
- text.replaceAll( /getI/, 'getI_doesntexistanymore')
- }
-
- def processFileInplace(file, Closure processText) {
- def text = file.text
- file.write(processText(text))
- }
- </source>
- </configuration>
+ <executions>
+ <execution>
+ <id>rename-method</id>
+ <configuration>
+ <source>
+ def beanAFile = new File( project.basedir,
'src/main/java/BeanA.java' )
+
+ beanAFile.write( beanAFile.text.replaceAll( /getI/,
'getI_doesntexistanymore' ) )
+ </source>
+ </configuration>
+ </execution>
+ <execution>
+ <id>restore-method</id>
+ <configuration>
+ <source>
+ def beanAFile = new File( project.basedir,
'src/main/java/BeanA.java' )
+
+ beanAFile.write( beanAFile.text.replaceAll(
/getI_doesntexistanymore/, 'getI' ) )
+ </source>
+ </configuration>
+ </execution>
+ <execution>
+ <id>remove-class</id>
+ <configuration>
+ <source>
+ def beanAFile = new File( project.basedir,
'src/main/java/BeanA.java' )
+
+ beanAFile.delete()
+ </source>
+ </configuration>
+ </execution>
+ </executions>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
diff --git a/src/it/mcompiler-21_class-remove/src/main/java/BeanA.java
b/src/it/mcompiler-21_incremental-source-change/src/main/java/BeanA.java
similarity index 100%
rename from src/it/mcompiler-21_class-remove/src/main/java/BeanA.java
rename to src/it/mcompiler-21_incremental-source-change/src/main/java/BeanA.java
diff --git a/src/it/mcompiler-21_class-remove/src/main/java/BeanA2.java
b/src/it/mcompiler-21_incremental-source-change/src/main/java/BeanA2.java
similarity index 100%
rename from src/it/mcompiler-21_class-remove/src/main/java/BeanA2.java
rename to
src/it/mcompiler-21_incremental-source-change/src/main/java/BeanA2.java
diff --git a/src/it/mcompiler-21_methodname-change/verify.groovy
b/src/it/mcompiler-21_incremental-source-change/verify.groovy
similarity index 78%
rename from src/it/mcompiler-21_methodname-change/verify.groovy
rename to src/it/mcompiler-21_incremental-source-change/verify.groovy
index 3e4f8d17..f7002f64 100644
--- a/src/it/mcompiler-21_methodname-change/verify.groovy
+++ b/src/it/mcompiler-21_incremental-source-change/verify.groovy
@@ -16,8 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-def logFile = new File( basedir, 'build.log' )
-assert logFile.exists()
-content = logFile.text
+def buildLog = new File(basedir, 'build.log').text
-assert content.contains( 'COMPILATION ERROR :' )
+// invoker appends the output of all goals to one log: one compilation error
per failed build
+assert buildLog.count('COMPILATION ERROR :') == 2
diff --git a/src/it/mcompiler-21_methodname-change/src/main/java/BeanA.java
b/src/it/mcompiler-21_methodname-change/src/main/java/BeanA.java
deleted file mode 100644
index c53e6bd6..00000000
--- a/src/it/mcompiler-21_methodname-change/src/main/java/BeanA.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-package foo;
-
-/**
- * dumb test bean
- */
-public class BeanA {
-
- private int i, y;
-
- public int getI() {
- return i;
- }
-
- public void setI(int i) {
- this.i = i;
- }
-}
diff --git a/src/it/mcompiler-21_methodname-change/src/main/java/BeanA2.java
b/src/it/mcompiler-21_methodname-change/src/main/java/BeanA2.java
deleted file mode 100644
index 076a1fc2..00000000
--- a/src/it/mcompiler-21_methodname-change/src/main/java/BeanA2.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-package foo;
-
-/**
- * dumb test bean
- */
-public class BeanA2 {
-
- private int i;
- private BeanA beanA;
-
- public int getI() {
- return beanA.getI();
- }
-
- public void setI(int i) {
- beanA.setI(i);
- }
-}