diff --git a/src/it/MDEPLOY-318-invalid-pom/invoker.properties b/.github/workflows/pr-automation.yml
similarity index 74%
rename from src/it/MDEPLOY-318-invalid-pom/invoker.properties
rename to .github/workflows/pr-automation.yml
index c32d7bb5..53075957 100644
--- a/src/it/MDEPLOY-318-invalid-pom/invoker.properties
+++ b/.github/workflows/pr-automation.yml
@@ -6,7 +6,7 @@
# "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
+# 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
@@ -15,4 +15,13 @@
# specific language governing permissions and limitations
# under the License.
-invoker.goals = clean jar:jar deploy:deploy
+name: PR Automation
+on:
+ pull_request_target:
+ types:
+ - closed
+
+jobs:
+ pr-automation:
+ name: PR Automation
+ uses: apache/maven-gh-actions-shared/.github/workflows/pr-automation.yml@v4
diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml
index 1049eaa3..77432128 100644
--- a/.github/workflows/release-drafter.yml
+++ b/.github/workflows/release-drafter.yml
@@ -19,7 +19,12 @@ name: Release Drafter
on:
push:
branches:
- - master
+ - maven-deploy-plugin-3.x
+ workflow_dispatch:
+
jobs:
update_release_draft:
uses: apache/maven-gh-actions-shared/.github/workflows/release-drafter.yml@v4
+ with:
+ config-name: 'release-drafter-3.x.yml'
+
diff --git a/README.md b/README.md
index 52b7b0fd..77abb0fa 100644
--- a/README.md
+++ b/README.md
@@ -17,8 +17,8 @@
Contributing to [Apache Maven Deploy Plugin](https://maven.apache.org/plugins/maven-deploy-plugin/)
======================
-[][jira]
[][license]
+[](https://search.maven.org/artifact/org.apache.maven.plugins/maven-deploy-plugin)
[](https://search.maven.org/artifact/org.apache.maven.plugins/maven-deploy-plugin)
[](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/org/apache/maven/plugins/maven-deploy-plugin/README.md)
[][build]
@@ -34,7 +34,6 @@ things.
Getting Started
---------------
-+ Make sure you have a [JIRA account](https://issues.apache.org/jira/).
+ Make sure you have a [GitHub account](https://github.com/signup/free).
+ If you're planning to implement a new feature, it makes sense to discuss your changes
on the [dev list][ml-list]] first.
@@ -60,37 +59,21 @@ There are some guidelines which will make applying PRs easier for us:
+ Create minimal diffs - disable on save actions like reformat source code or organize imports.
If you feel the source code should be reformatted, create a separate PR for this change.
+ Check for unnecessary whitespace with `git diff --check` before committing.
-+ Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue.
-```
-[MDEPLOY-XXX] - Subject of the JIRA Ticket
- Optional supplemental description.
-```
+ Make sure you have added the necessary tests (JUnit/IT) for your changes.
+ Run all the tests with `mvn -Prun-its verify` to assure nothing else was accidentally broken.
+ Submit a pull request to the repository in the Apache organization.
-+ Update your JIRA ticket and include a link to the pull request in the ticket.
If you plan to contribute on a regular basis, please consider filing a [contributor license agreement][cla].
-Making Trivial Changes
-----------------------
-
-For changes of a trivial nature to comments and documentation, it is not always
-necessary to create a new ticket in JIRA. In this case, it is appropriate to
-start the first line of a commit with '(doc)' instead of a ticket number.
-
Additional Resources
--------------------
+ [Contributing patches](https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch)
-+ [Apache Maven Deploy JIRA project page][jira]
+ [Contributor License Agreement][cla]
+ [General GitHub documentation](https://help.github.com/)
+ [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
+ [Apache Maven Twitter Account](https://twitter.com/ASFMavenProject)
-+ #Maven IRC channel on freenode.org
-[jira]: https://issues.apache.org/jira/projects/MDEPLOY/
[license]: https://www.apache.org/licenses/LICENSE-2.0
[ml-list]: https://maven.apache.org/mailing-lists.html
[code-style]: https://maven.apache.org/developers/conventions/code.html
diff --git a/pom.xml b/pom.xml
index 72dfbfe0..34d3f135 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,12 +23,12 @@ under the License.
org.apache.maven.plugins
maven-plugins
- 42
+ 45
maven-deploy-plugin
- 3.1.3-SNAPSHOT
+ 3.1.5-SNAPSHOT
maven-plugin
Apache Maven Deploy Plugin
@@ -53,8 +53,8 @@ under the License.
https://github.com/apache/maven-deploy-plugin/tree/${project.scm.tag}
- JIRA
- https://issues.apache.org/jira/browse/MDEPLOY
+ GitHub
+ https://github.com/apache/maven-deploy-plugin/issues
Jenkins
@@ -69,11 +69,11 @@ under the License.
8
- 3.9.6
-
+ 3.9.9
+
+ 1.9.22
+
1.7.36
-
- 1.9.20
${version.maven-antrun-plugin}
@@ -88,7 +88,7 @@ under the License.
${version.maven-surefire}
${version.maven-war-plugin}
- 2024-04-26T10:30:44Z
+ 2025-02-23T17:24:00Z
@@ -149,6 +149,7 @@ under the License.
org.apache.maven.plugin-tools
maven-plugin-annotations
+ ${version.maven-plugin-tools}
provided
@@ -210,19 +211,6 @@ under the License.
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- none
- true
-
-
-
-
-
run-its
diff --git a/src/it/MDEPLOY-318-invalid-pom/pom.xml b/src/it/MDEPLOY-318-invalid-pom/pom.xml
deleted file mode 100644
index 2ac4f83c..00000000
--- a/src/it/MDEPLOY-318-invalid-pom/pom.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
- 4.0.0
-
- org.apache.maven.its.deploy.invalid-pom
- test
- 1.0
- pom
-
-
- Tests the deployment of a simple release POM.
-
-
-
- true
-
-
-
-
- it
- file:///${basedir}/target/repo
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- @mavenCompilerPluginVersion@
-
-
- org.apache.maven.plugins
- maven-deploy-plugin
- @project.version@
-
-
- org.apache.maven.plugins
- maven-install-plugin
- @mavenInstallPluginVersion@
-
-
- org.apache.maven.plugins
- maven-resources-plugin
- @mavenResourcesPluginVersion@
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- @mavenSurefirePluginVersion@
-
-
-
-
-
diff --git a/src/it/deploy-bom/verify.groovy b/src/it/deploy-bom/verify.groovy
index 2b314e99..89795885 100644
--- a/src/it/deploy-bom/verify.groovy
+++ b/src/it/deploy-bom/verify.groovy
@@ -18,7 +18,6 @@
*/
def expectedDeploys = [
- 'org/apache/maven/its/deploy/bom/test/1.0/test-1.0-build.pom',
'org/apache/maven/its/deploy/bom/test/1.0/test-1.0.pom',
'org/apache/maven/its/deploy/bom/test/maven-metadata.xml',
]
diff --git a/src/it/gav-validation/invoker.properties b/src/it/gav-validation/invoker.properties
index 6635374e..051dc7ed 100644
--- a/src/it/gav-validation/invoker.properties
+++ b/src/it/gav-validation/invoker.properties
@@ -18,5 +18,5 @@
invoker.goals = org.apache.maven.plugins:maven-deploy-plugin:${project.version}:deploy-file
invoker.buildResult = failure
-invoker.systemPropertiesFile.1 = test-invalid.properties
-invoker.systemPropertiesFile.2 = test-missing.properties
+invoker.userPropertiesFile.1 = test-invalid.properties
+invoker.userPropertiesFile.2 = test-missing.properties
diff --git a/src/it/no-main-artifact-1/verify.groovy b/src/it/no-main-artifact-1/verify.groovy
index 9442aa7d..7274ba5c 100644
--- a/src/it/no-main-artifact-1/verify.groovy
+++ b/src/it/no-main-artifact-1/verify.groovy
@@ -19,5 +19,5 @@
def buildLog = new File ( basedir, "build.log")
-assert buildLog.text.contains( "The packaging plugin for this project did not assign "
+assert buildLog.text.contains( "The packaging plugin for project test did not assign "
+ "a main file to the project but it has attachments. Change packaging to 'pom'." )
\ No newline at end of file
diff --git a/src/it/no-main-artifact-2/verify.groovy b/src/it/no-main-artifact-2/verify.groovy
index 9442aa7d..7274ba5c 100644
--- a/src/it/no-main-artifact-2/verify.groovy
+++ b/src/it/no-main-artifact-2/verify.groovy
@@ -19,5 +19,5 @@
def buildLog = new File ( basedir, "build.log")
-assert buildLog.text.contains( "The packaging plugin for this project did not assign "
+assert buildLog.text.contains( "The packaging plugin for project test did not assign "
+ "a main file to the project but it has attachments. Change packaging to 'pom'." )
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java b/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
index 7e6536f1..0dfc8c36 100644
--- a/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
+++ b/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
@@ -55,6 +55,8 @@
import org.eclipse.aether.deployment.DeploymentException;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.util.artifact.SubArtifact;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Installs the artifact in the remote repository.
@@ -63,6 +65,7 @@
*/
@Mojo(name = "deploy-file", requiresProject = false, threadSafe = true)
public class DeployFileMojo extends AbstractDeployMojo {
+ private final Logger log = LoggerFactory.getLogger(getClass());
/**
* GroupId of the artifact to be deployed. Retrieved from POM file if specified.
*/
@@ -90,6 +93,15 @@ public class DeployFileMojo extends AbstractDeployMojo {
@Parameter(property = "packaging")
private String packaging;
+ /**
+ * Extension of the artifact to be deployed. If set, will override plugin own logic to detect extension. If not set,
+ * as Maven expected, packaging determines the artifact extension.
+ *
+ * @since 3.1.3
+ */
+ @Parameter(property = "extension")
+ private String extension;
+
/**
* Description passed to a generated POM file (in case of generatePom=true)
*/
@@ -196,7 +208,7 @@ void initProperties() throws MojoExecutionException {
JarEntry entry = jarEntries.nextElement();
if (pomEntry.matcher(entry.getName()).matches()) {
- getLog().debug("Using " + entry.getName() + " as pomFile");
+ log.debug("Using {} as pomFile", entry.getName());
foundPom = true;
String base = file.getName();
if (base.indexOf('.') > 0) {
@@ -215,7 +227,7 @@ void initProperties() throws MojoExecutionException {
}
if (!foundPom) {
- getLog().info("pom.xml not found in " + file.getName());
+ log.info("pom.xml not found in {}", file.getName());
}
} catch (IOException e) {
// ignore, artifact not packaged by Maven
@@ -229,11 +241,13 @@ void initProperties() throws MojoExecutionException {
}
}
+ @Override
+ @SuppressWarnings("MethodLength")
public void execute() throws MojoExecutionException, MojoFailureException {
if (Boolean.parseBoolean(skip)
|| ("releases".equals(skip) && !ArtifactUtils.isSnapshot(version))
|| ("snapshots".equals(skip) && ArtifactUtils.isSnapshot(version))) {
- getLog().info("Skipping artifact deployment");
+ log.info("Skipping artifact deployment");
return;
}
@@ -264,18 +278,29 @@ public void execute() throws MojoExecutionException, MojoFailureException {
DeployRequest deployRequest = new DeployRequest();
deployRequest.setRepository(remoteRepository);
- boolean isFilePom = classifier == null && "pom".equals(packaging);
- if (!isFilePom) {
+ String mainArtifactExtension;
+ if (classifier == null && "pom".equals(packaging)) {
+ mainArtifactExtension = "pom";
+ } else {
ArtifactType artifactType =
session.getRepositorySession().getArtifactTypeRegistry().get(packaging);
- if (artifactType != null
- && (classifier == null || classifier.isEmpty())
- && !StringUtils.isEmpty(artifactType.getClassifier())) {
- classifier = artifactType.getClassifier();
+ if (artifactType != null) {
+ if (StringUtils.isEmpty(classifier) && !StringUtils.isEmpty(artifactType.getClassifier())) {
+ classifier = artifactType.getClassifier();
+ }
+ mainArtifactExtension = artifactType.getExtension();
+ } else {
+ mainArtifactExtension = packaging;
}
}
+ if (extension != null && !Objects.equals(extension, mainArtifactExtension)) {
+ log.warn(
+ "Main artifact extension should be '{}' but was overridden to '{}'",
+ mainArtifactExtension,
+ extension);
+ }
Artifact mainArtifact = new DefaultArtifact(
- groupId, artifactId, classifier, isFilePom ? "pom" : getExtension(file), version)
+ groupId, artifactId, classifier, extension != null ? extension : mainArtifactExtension, version)
.setFile(file);
deployRequest.addArtifact(mainArtifact);
@@ -291,10 +316,10 @@ public void execute() throws MojoExecutionException, MojoFailureException {
deployRequest.addArtifact(new SubArtifact(mainArtifact, "", "pom", pomFile));
} else if (generatePom) {
temporaryPom = generatePomFile();
- getLog().debug("Deploying generated POM");
+ log.debug("Deploying generated POM");
deployRequest.addArtifact(new SubArtifact(mainArtifact, "", "pom", temporaryPom));
} else {
- getLog().debug("Skipping deploying POM");
+ log.debug("Skipping deploying POM");
}
}
diff --git a/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java b/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
index 79ee1d87..7cf7a7ef 100644
--- a/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
+++ b/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
@@ -180,6 +180,7 @@ private boolean hasState(MavenProject project) {
return pluginContext.containsKey(DEPLOY_PROCESSED_MARKER);
}
+ @Override
public void execute() throws MojoExecutionException, MojoFailureException {
State state;
if (Boolean.parseBoolean(skip)
@@ -381,20 +382,16 @@ RemoteRepository getDeploymentRepository(
+ "\" instead.");
repo = getRemoteRepository(id, url);
} else {
- throw new MojoExecutionException(
- altDeploymentRepo,
- "Invalid legacy syntax and layout for repository.",
- "Invalid legacy syntax and layout for alternative repository. Use \"" + id + "::" + url
- + "\" instead, and only default layout is supported.");
+ throw new MojoExecutionException("Invalid legacy syntax and layout for alternative repository: \""
+ + altDeploymentRepo + "\". Use \"" + id + "::" + url
+ + "\" instead, and only default layout is supported.");
}
} else {
matcher = ALT_REPO_SYNTAX_PATTERN.matcher(altDeploymentRepo);
if (!matcher.matches()) {
- throw new MojoExecutionException(
- altDeploymentRepo,
- "Invalid syntax for repository.",
- "Invalid syntax for alternative repository. Use \"id::url\".");
+ throw new MojoExecutionException("Invalid syntax for alternative repository: \"" + altDeploymentRepo
+ + "\". Use \"id::url\".");
} else {
String id = matcher.group(1).trim();
String url = matcher.group(2).trim();
diff --git a/src/site/site.xml b/src/site/site.xml
index 6df80c46..d5800873 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -48,7 +48,7 @@ under the License.