You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sj...@apache.org on 2026/06/12 19:33:38 UTC

(tooling-atr-maven-plugin) branch main updated: Configured plugin execution to run only at the root module by default

This is an automated email from the ASF dual-hosted git repository.

slawekjaranowski pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-atr-maven-plugin.git


The following commit(s) were added to refs/heads/main by this push:
     new e867369  Configured plugin execution to run only at the root module by default
e867369 is described below

commit e8673691a0a46718022944850d909af9667c6ee1
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Sun Jun 7 22:44:23 2026 +0200

    Configured plugin execution to run only at the root module by default
    
    - Added an integration test (IT) structure for multimodule projects.
    - Included two multimodule test scenarios: execution only in the root module and execution in submodules.
    - Verified correct behavior of plugin execution, file uploads, and skips in submodules.
---
 .../upload-multimodule-module/invoker.properties   | 18 ++++
 src/it/upload-multimodule-module/module1/pom.xml   | 41 +++++++++
 src/it/upload-multimodule-module/module2/pom.xml   | 30 +++++++
 src/it/upload-multimodule-module/pom.xml           | 98 ++++++++++++++++++++++
 src/it/upload-multimodule-module/verify.groovy     | 37 ++++++++
 src/it/upload-multimodule-root/invoker.properties  | 18 ++++
 src/it/upload-multimodule-root/module1/pom.xml     | 30 +++++++
 src/it/upload-multimodule-root/module2/pom.xml     | 30 +++++++
 src/it/upload-multimodule-root/pom.xml             | 89 ++++++++++++++++++++
 src/it/upload-multimodule-root/verify.groovy       | 37 ++++++++
 .../org/apache/tooling/atr/AbstractAtrMojo.java    |  2 +-
 11 files changed, 429 insertions(+), 1 deletion(-)

diff --git a/src/it/upload-multimodule-module/invoker.properties b/src/it/upload-multimodule-module/invoker.properties
new file mode 100644
index 0000000..a8c0237
--- /dev/null
+++ b/src/it/upload-multimodule-module/invoker.properties
@@ -0,0 +1,18 @@
+# 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 = deploy
diff --git a/src/it/upload-multimodule-module/module1/pom.xml b/src/it/upload-multimodule-module/module1/pom.xml
new file mode 100644
index 0000000..ff60c73
--- /dev/null
+++ b/src/it/upload-multimodule-module/module1/pom.xml
@@ -0,0 +1,41 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.tooling.its.atr</groupId>
+    <artifactId>tooling-atr-multimodule</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>module1</artifactId>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.tooling</groupId>
+        <artifactId>atr-maven-plugin</artifactId>
+        <configuration>
+          <runOnlyAtExecutionRoot>false</runOnlyAtExecutionRoot>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/upload-multimodule-module/module2/pom.xml b/src/it/upload-multimodule-module/module2/pom.xml
new file mode 100644
index 0000000..41956be
--- /dev/null
+++ b/src/it/upload-multimodule-module/module2/pom.xml
@@ -0,0 +1,30 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.tooling.its.atr</groupId>
+    <artifactId>tooling-atr-multimodule</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>module2</artifactId>
+
+</project>
diff --git a/src/it/upload-multimodule-module/pom.xml b/src/it/upload-multimodule-module/pom.xml
new file mode 100644
index 0000000..30c0d9f
--- /dev/null
+++ b/src/it/upload-multimodule-module/pom.xml
@@ -0,0 +1,98 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache</groupId>
+    <artifactId>apache</artifactId>
+    <version>@project.parent.version@</version>
+  </parent>
+
+  <groupId>org.apache.tooling.its.atr</groupId>
+  <artifactId>tooling-atr-multimodule</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <name>ATR Plugin IT</name>
+  <description>Integration test for multimodule project - excuting in submodule</description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <maven.deploy.skip>true</maven.deploy.skip>
+  </properties>
+
+  <modules>
+    <module>module1</module>
+    <module>module2</module>
+  </modules>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.tooling</groupId>
+          <artifactId>atr-maven-plugin</artifactId>
+          <version>@project.version@</version>
+          <executions>
+            <execution>
+              <id>upload-to-atr</id>
+              <goals>
+                <goal>upload</goal>
+              </goals>
+              <configuration>
+                <files>
+                  <file>${project.build.directory}/${project.artifactId}-${project.version}-source-release.zip</file>
+                  <file>${project.build.directory}/${project.artifactId}-${project.version}-source-release.zip.sha512</file>
+                </files>
+              </configuration>
+            </execution>
+          </executions>
+          <dependencies>
+            <dependency>
+              <!-- use Mock ATR client for testing -->
+              <groupId>org.apache.tooling</groupId>
+              <artifactId>atr-maven-plugin</artifactId>
+              <version>@project.version@</version>
+              <type>test-jar</type>
+            </dependency>
+          </dependencies>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+
+    <plugins>
+      <plugin>
+        <groupId>org.apache.tooling</groupId>
+        <artifactId>atr-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <inherited>false</inherited>
+            <id>upload-to-atr</id>
+            <configuration>
+              <skip>true</skip>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git a/src/it/upload-multimodule-module/verify.groovy b/src/it/upload-multimodule-module/verify.groovy
new file mode 100644
index 0000000..5cc4796
--- /dev/null
+++ b/src/it/upload-multimodule-module/verify.groovy
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+// Verify that the build log contains evidence of the ATR plugin execution
+def buildLog = new File(basedir, 'build.log')
+assert buildLog.exists()
+
+// The mock client should be called 4 times only in one module
+assert buildLog.text.count('[INFO] [Mock ATR client]') == 4:
+        'Expected message not found in build log'
+
+assert buildLog.text.count('[INFO] [Mock ATR client] uploadFile: module1, 1.0-SNAPSHOT, module1-1.0-SNAPSHOT-source-release.zip,') == 1:
+        'Expected message not found in build log'
+
+assert buildLog.text.count('[INFO] [Mock ATR client] uploadFile: module1, 1.0-SNAPSHOT, module1-1.0-SNAPSHOT-source-release.zip.sha512,') == 1:
+        'Expected message not found in build log'
+
+// Skip execution in root module and in one submodule
+assert buildLog.text.count('[INFO] Skipping ATR plugin execution') == 2:
+        'Expected message not found in build log'
+
diff --git a/src/it/upload-multimodule-root/invoker.properties b/src/it/upload-multimodule-root/invoker.properties
new file mode 100644
index 0000000..a8c0237
--- /dev/null
+++ b/src/it/upload-multimodule-root/invoker.properties
@@ -0,0 +1,18 @@
+# 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 = deploy
diff --git a/src/it/upload-multimodule-root/module1/pom.xml b/src/it/upload-multimodule-root/module1/pom.xml
new file mode 100644
index 0000000..68dd960
--- /dev/null
+++ b/src/it/upload-multimodule-root/module1/pom.xml
@@ -0,0 +1,30 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.tooling.its.atr</groupId>
+    <artifactId>tooling-atr-multimodule</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>module1</artifactId>
+
+</project>
diff --git a/src/it/upload-multimodule-root/module2/pom.xml b/src/it/upload-multimodule-root/module2/pom.xml
new file mode 100644
index 0000000..41956be
--- /dev/null
+++ b/src/it/upload-multimodule-root/module2/pom.xml
@@ -0,0 +1,30 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.tooling.its.atr</groupId>
+    <artifactId>tooling-atr-multimodule</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>module2</artifactId>
+
+</project>
diff --git a/src/it/upload-multimodule-root/pom.xml b/src/it/upload-multimodule-root/pom.xml
new file mode 100644
index 0000000..134b06c
--- /dev/null
+++ b/src/it/upload-multimodule-root/pom.xml
@@ -0,0 +1,89 @@
+<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache</groupId>
+    <artifactId>apache</artifactId>
+    <version>@project.parent.version@</version>
+  </parent>
+
+  <groupId>org.apache.tooling.its.atr</groupId>
+  <artifactId>tooling-atr-multimodule</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <name>ATR Plugin IT</name>
+  <description>Integration test for multimodule project – execution only in root</description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <maven.deploy.skip>true</maven.deploy.skip>
+  </properties>
+
+  <modules>
+    <module>module1</module>
+    <module>module2</module>
+  </modules>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.tooling</groupId>
+          <artifactId>atr-maven-plugin</artifactId>
+          <version>@project.version@</version>
+          <executions>
+            <execution>
+              <id>upload-to-atr</id>
+              <goals>
+                <goal>upload</goal>
+              </goals>
+              <configuration>
+                <files>
+                  <file>${project.build.directory}/${project.artifactId}-${project.version}-source-release.zip</file>
+                  <file>${project.build.directory}/${project.artifactId}-${project.version}-source-release.zip.sha512</file>
+                </files>
+              </configuration>
+            </execution>
+          </executions>
+          <dependencies>
+            <dependency>
+              <!-- use Mock ATR client for testing -->
+              <groupId>org.apache.tooling</groupId>
+              <artifactId>atr-maven-plugin</artifactId>
+              <version>@project.version@</version>
+              <type>test-jar</type>
+            </dependency>
+          </dependencies>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+
+  <plugins>
+    <plugin>
+      <groupId>org.apache.tooling</groupId>
+      <artifactId>atr-maven-plugin</artifactId>
+    </plugin>
+  </plugins>
+  </build>
+
+</project>
diff --git a/src/it/upload-multimodule-root/verify.groovy b/src/it/upload-multimodule-root/verify.groovy
new file mode 100644
index 0000000..9cb7ca8
--- /dev/null
+++ b/src/it/upload-multimodule-root/verify.groovy
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+// Verify that the build log contains evidence of the ATR plugin execution
+def buildLog = new File(basedir, 'build.log')
+assert buildLog.exists()
+
+// The mock client should be called 4 times only in one module
+assert buildLog.text.count('[INFO] [Mock ATR client]') == 4:
+        'Expected message not found in build log'
+
+assert buildLog.text.count('[INFO] [Mock ATR client] uploadFile: tooling-atr-multimodule, 1.0-SNAPSHOT, tooling-atr-multimodule-1.0-SNAPSHOT-source-release.zip,') == 1:
+        'Expected message not found in build log'
+
+assert buildLog.text.count('[INFO] [Mock ATR client] uploadFile: tooling-atr-multimodule, 1.0-SNAPSHOT, tooling-atr-multimodule-1.0-SNAPSHOT-source-release.zip.sha512,') == 1:
+        'Expected message not found in build log'
+
+// The submodules should log a message about skipping the plugin execution
+assert buildLog.text.count('Skipping ATR plugin execution (not execution root)') == 2:
+        'Expected message not found in build log'
+
diff --git a/src/main/java/org/apache/tooling/atr/AbstractAtrMojo.java b/src/main/java/org/apache/tooling/atr/AbstractAtrMojo.java
index 206f91a..417598f 100644
--- a/src/main/java/org/apache/tooling/atr/AbstractAtrMojo.java
+++ b/src/main/java/org/apache/tooling/atr/AbstractAtrMojo.java
@@ -93,7 +93,7 @@ public abstract class AbstractAtrMojo extends AbstractMojo {
      *
      * @since 1.0.0-beta-1
      */
-    @Parameter(property = "atr.runOnlyAtExecutionRoot", defaultValue = "false")
+    @Parameter(property = "atr.runOnlyAtExecutionRoot", defaultValue = "true")
     protected boolean runOnlyAtExecutionRoot;
 
     private final MavenProject mavenProject;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org