This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch maven-atr-plugin
in repository https://gitbox.apache.org/repos/asf/maven-studies.git
The following commit(s) were added to refs/heads/maven-atr-plugin by this push:
new 188a9553a create atr:upload goal doing log
188a9553a is described below
commit 188a9553a50c735d8763919f9863cf8810dfbb8d
Author: Hervé Boutemy <[email protected]>
AuthorDate: Sat Mar 14 20:18:44 2026 +0100
create atr:upload goal doing log
---
.asf.yaml | 38 +++++++
.gitignore | 22 ++++
README.md | 21 +++-
pom.xml | 64 +++++++++++
src/it/apache-release-profile/invoker.properties | 20 ++++
src/it/apache-release-profile/pom.xml | 85 ++++++++++++++
.../main/java/org/apache/maven/its/atr/App.java | 28 +++++
src/it/apache-release-profile/verify.groovy | 27 +++++
src/it/settings.xml | 53 +++++++++
.../apache/maven/plugins/atr/AbstractAtrMojo.java | 70 ++++++++++++
.../org/apache/maven/plugins/atr/UploadMojo.java | 126 +++++++++++++++++++++
11 files changed, 553 insertions(+), 1 deletion(-)
diff --git a/.asf.yaml b/.asf.yaml
new file mode 100644
index 000000000..9db50cf3a
--- /dev/null
+++ b/.asf.yaml
@@ -0,0 +1,38 @@
+# 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.
+
+github:
+ description: "Apache Maven ATR Plugin"
+ homepage: https://maven.apache.org/plugins/maven-atr-plugin/
+ labels:
+ - maven
+ - build-management
+ - apache
+ - atr
+ features:
+ wiki: false
+ issues: true
+ projects: false
+ enabled_merge_buttons:
+ squash: false
+ merge: false
+ rebase: true
+
+notifications:
+ commits: [email protected]
+ issues: [email protected]
+ pullrequests: [email protected]
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..0d101bd29
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,22 @@
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+.mvn/wrapper/maven-wrapper.jar
+
+# IDE
+.idea/
+*.iml
+.project
+.classpath
+.settings/
+.vscode/
+
+# OS
+.DS_Store
+Thumbs.db
diff --git a/README.md b/README.md
index b465bd8be..cd758b2ea 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,26 @@
+<!---
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
# Maven ATR Plugin
Studying ATR integration for Maven.
It starts with a Maven plugin to [upload Apache distribution
artifacts](https://release-test.apache.org/tutorial) to ATR before vote, like
[`atr upload`
CLI](https://github.com/apache/tooling-releases-client/blob/main/COMMANDS.md#atr-upload).
-This can in the future be triggered during `mvn deploy` in an `atr` profile
along `apache-release` one.
+This can be triggered during `mvn deploy` in an `atr` profile along
`apache-release` one: see IT `mvn -Prun-its verify` for demo.
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 000000000..dcbecd67e
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,64 @@
+<?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.maven.plugins</groupId>
+ <artifactId>maven-plugins</artifactId>
+ <version>43</version>
+ <relativePath />
+ </parent>
+
+ <artifactId>maven-atr-plugin</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+
+ <name>Apache Maven ATR Plugin</name>
+ <description>Maven plugin for ATR (Apache Test Release) integration to
upload Apache distribution artifacts.</description>
+
+ <prerequisites>
+ <maven>${mavenVersion}</maven>
+ </prerequisites>
+
+ <properties>
+ <mavenVersion>3.6.3</mavenVersion>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>${mavenVersion}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>${mavenVersion}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/src/it/apache-release-profile/invoker.properties
b/src/it/apache-release-profile/invoker.properties
new file mode 100644
index 000000000..3768c2132
--- /dev/null
+++ b/src/it/apache-release-profile/invoker.properties
@@ -0,0 +1,20 @@
+# 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.
+
+# Test with apache-release profile activated
+invoker.goals = deploy -Papache-release
+invoker.buildResult = success
diff --git a/src/it/apache-release-profile/pom.xml
b/src/it/apache-release-profile/pom.xml
new file mode 100644
index 000000000..2b8c16413
--- /dev/null
+++ b/src/it/apache-release-profile/pom.xml
@@ -0,0 +1,85 @@
+<?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>33</version>
+ </parent>
+
+ <groupId>org.apache.maven.its.atr</groupId>
+ <artifactId>test-apache-release</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <name>ATR Plugin IT - Apache Release Profile</name>
+ <description>Integration test for maven-atr-plugin with apache-release
profile</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.deploy.skip>true</maven.deploy.skip>
+ <gpg.skip>true</gpg.skip>
+ </properties>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-atr-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>apache-release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-atr-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>upload-to-atr</id>
+ <goals>
+ <goal>upload</goal>
+ </goals>
+ <configuration>
+ <dryRun>true</dryRun>
+ <project>${project.artifactId}</project>
+ <version>${project.version}</version>
+ <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>
+
<!--file>${project.build.directory}/${project.artifactId}-${project.version}-source-release.zip.asc</file-->
+ </files>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git
a/src/it/apache-release-profile/src/main/java/org/apache/maven/its/atr/App.java
b/src/it/apache-release-profile/src/main/java/org/apache/maven/its/atr/App.java
new file mode 100644
index 000000000..20f13d0cb
--- /dev/null
+++
b/src/it/apache-release-profile/src/main/java/org/apache/maven/its/atr/App.java
@@ -0,0 +1,28 @@
+/*
+ * 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 org.apache.maven.its.atr;
+
+/**
+ * Simple test application.
+ */
+public class App {
+ public static void main(String[] args) {
+ System.out.println("Hello from ATR Integration Test!");
+ }
+}
diff --git a/src/it/apache-release-profile/verify.groovy
b/src/it/apache-release-profile/verify.groovy
new file mode 100644
index 000000000..152cae182
--- /dev/null
+++ b/src/it/apache-release-profile/verify.groovy
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Verify that the build log contains evidence of the ATR plugin execution
+def buildLog = new File(basedir, 'build.log')
+assert buildLog.exists()
+assert buildLog.text.contains('DRY RUN: Simulating ATR upload')
+assert buildLog.text.contains('DRY RUN: Would upload:')
+assert buildLog.text.contains('to
https://release-test.apache.org/file/test-apache-release/1.0-SNAPSHOT/test-apache-release-1.0-SNAPSHOT-source-release.zip')
+
+return true
diff --git a/src/it/settings.xml b/src/it/settings.xml
new file mode 100644
index 000000000..c48fb3095
--- /dev/null
+++ b/src/it/settings.xml
@@ -0,0 +1,53 @@
+<?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.
+-->
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
+ <profiles>
+ <profile>
+ <id>it-repo</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <repositories>
+ <repository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
+</settings>
diff --git a/src/main/java/org/apache/maven/plugins/atr/AbstractAtrMojo.java
b/src/main/java/org/apache/maven/plugins/atr/AbstractAtrMojo.java
new file mode 100644
index 000000000..660c80065
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/atr/AbstractAtrMojo.java
@@ -0,0 +1,70 @@
+/*
+ * 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 org.apache.maven.plugins.atr;
+
+import java.net.URL;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Parameter;
+
+/**
+ * Abstract base class for ATR Mojos.
+ *
+ * @author Maven Team
+ */
+public abstract class AbstractAtrMojo extends AbstractMojo {
+
+ /**
+ * The ATR server URL.
+ */
+ @Parameter(property = "atr.url", defaultValue =
"https://release-test.apache.org/")
+ protected URL url;
+
+ /**
+ * Skip plugin execution.
+ */
+ @Parameter(property = "atr.skip", defaultValue = "false")
+ protected boolean skip;
+
+ /**
+ * Dry run mode. When enabled, the plugin will simulate execution without
performing actual operations.
+ */
+ @Parameter(property = "atr.dryRun", defaultValue = "false")
+ protected boolean dryRun;
+
+ @Override
+ public final void execute() throws MojoExecutionException,
MojoFailureException {
+ if (skip) {
+ getLog().info("Skipping ATR plugin execution");
+ return;
+ }
+
+ atrExecute();
+ }
+
+ /**
+ * Execute the ATR-specific logic.
+ *
+ * @throws MojoExecutionException if an error occurs during execution
+ * @throws MojoFailureException if a failure occurs during execution
+ */
+ protected abstract void atrExecute() throws MojoExecutionException,
MojoFailureException;
+}
diff --git a/src/main/java/org/apache/maven/plugins/atr/UploadMojo.java
b/src/main/java/org/apache/maven/plugins/atr/UploadMojo.java
new file mode 100644
index 000000000..7602632e7
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/atr/UploadMojo.java
@@ -0,0 +1,126 @@
+/*
+ * 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 org.apache.maven.plugins.atr;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.nio.file.Path;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+
+/**
+ * Upload Apache distribution artifacts to ATR (Apache Test Release) compose
space before vote.
+ *
+ * @author Maven Team
+ */
+@Mojo(name = "upload", requiresProject = true, defaultPhase =
LifecyclePhase.DEPLOY, threadSafe = true)
+public class UploadMojo extends AbstractAtrMojo {
+
+ /**
+ * The project name for ATR upload.
+ */
+ @Parameter(property = "atr.project", required = true)
+ private String project;
+
+ /**
+ * The version for ATR upload.
+ */
+ @Parameter(property = "atr.version", required = true)
+ private String version;
+
+ /**
+ * The files to upload to ATR.
+ */
+ @Parameter(property = "atr.files", required = true)
+ private Path[] files;
+
+ /**
+ * The target directory in ATR upload area where files will be uploaded.
+ * If not specified, files will be uploaded to the default location.
+ */
+ @Parameter(property = "atr.directory")
+ private String directory;
+
+ @Override
+ protected void atrExecute() throws MojoExecutionException,
MojoFailureException {
+ if (dryRun) {
+ getLog().info("DRY RUN: Simulating ATR upload (no actual upload
will occur)");
+ } else {
+ getLog().info("Uploading artifacts to ATR...");
+ }
+ getLog().info("Project: " + project);
+ getLog().info("Version: " + version);
+ if (directory != null) {
+ getLog().info("Directory: " + directory);
+ }
+ getLog().info("Files: " + files.length);
+
+ for (Path file : files) {
+ upload(file);
+ }
+ }
+
+ /**
+ * Upload a single file to ATR.
+ *
+ * @param file the file to upload
+ * @throws MojoExecutionException if an error occurs during upload
+ * @throws MojoFailureException if the upload fails
+ */
+ private void upload(Path file) throws MojoExecutionException,
MojoFailureException {
+ if (dryRun) {
+ getLog().info("DRY RUN: Would upload: " + file.getFileName() + "
to " + getComposeUrl(file));
+ return;
+ }
+
+ getLog().info("Uploading: " + file.getFileName() + " to " +
getComposeUrl(file));
+
+ // TODO: Implement ATR upload logic for single file
+ // This will integrate with the ATR CLI (atr upload) functionality
+ // to upload Apache distribution artifacts to release-test.apache.org
+ }
+
+ /**
+ * Get the compose URL for a file by combining the base URL, project,
version, directory, and filename.
+ *
+ * @param file the file to get the compose URL for
+ * @return the compose URL
+ * @throws MojoExecutionException if the URL cannot be constructed
+ */
+ private URL getComposeUrl(Path file) throws MojoExecutionException {
+ StringBuilder path = new StringBuilder("file/")
+ .append(project)
+ .append("/")
+ .append(version)
+ .append("/");
+ if (directory != null) {
+ path.append(directory).append("/");
+ }
+ path.append(file.getFileName().toString());
+ try {
+ return new URL(url, path.toString());
+ } catch (MalformedURLException e) {
+ throw new MojoExecutionException("Failed to construct compose URL
for file: " + file, e);
+ }
+ }
+}