You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2023/01/21 13:18:59 UTC

[maven-deploy-plugin] branch master updated: [MDEPLOY-272] - Skip deploy-file as done in DeployMojo

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

sjaranowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-deploy-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 11474f1  [MDEPLOY-272] - Skip deploy-file as done in DeployMojo
11474f1 is described below

commit 11474f15ac679090dbe38e20a3b3c41f0d34e85c
Author: Jens Awisus <aw...@gmail.com>
AuthorDate: Fri Dec 2 20:41:29 2022 +0100

    [MDEPLOY-272] - Skip deploy-file as done in DeployMojo
---
 .../invoker.properties                             | 17 ++++++++
 src/it/deployfile-release-skip-fail/pom.xml        | 48 ++++++++++++++++++++++
 .../deployfile-release-skip-fail/test.properties   | 18 ++++++++
 src/it/deployfile-release-skip-fail/verify.groovy  | 26 ++++++++++++
 src/it/deployfile-release-skip/invoker.properties  | 17 ++++++++
 src/it/deployfile-release-skip/pom.xml             | 48 ++++++++++++++++++++++
 src/it/deployfile-release-skip/test.properties     | 18 ++++++++
 src/it/deployfile-release-skip/verify.groovy       | 24 +++++++++++
 src/it/deployfile-skip-fail/invoker.properties     | 17 ++++++++
 src/it/deployfile-skip-fail/pom.xml                | 47 +++++++++++++++++++++
 src/it/deployfile-skip-fail/test.properties        | 18 ++++++++
 src/it/deployfile-skip-fail/verify.groovy          | 26 ++++++++++++
 src/it/deployfile-skip/invoker.properties          | 17 ++++++++
 src/it/deployfile-skip/pom.xml                     | 47 +++++++++++++++++++++
 src/it/deployfile-skip/test.properties             | 18 ++++++++
 src/it/deployfile-skip/verify.groovy               | 24 +++++++++++
 .../invoker.properties                             | 17 ++++++++
 src/it/deployfile-snapshot-skip-fail/pom.xml       | 48 ++++++++++++++++++++++
 .../deployfile-snapshot-skip-fail/test.properties  | 18 ++++++++
 src/it/deployfile-snapshot-skip-fail/verify.groovy | 28 +++++++++++++
 src/it/deployfile-snapshot-skip/invoker.properties | 17 ++++++++
 src/it/deployfile-snapshot-skip/pom.xml            | 48 ++++++++++++++++++++++
 src/it/deployfile-snapshot-skip/test.properties    | 18 ++++++++
 src/it/deployfile-snapshot-skip/verify.groovy      | 24 +++++++++++
 .../maven/plugins/deploy/DeployFileMojo.java       | 24 +++++++++++
 .../maven/plugins/deploy/DeployFileMojoTest.java   |  4 ++
 .../unit/deploy-file-test/plugin-config.xml        |  1 +
 27 files changed, 677 insertions(+)

diff --git a/src/it/deployfile-release-skip-fail/invoker.properties b/src/it/deployfile-release-skip-fail/invoker.properties
new file mode 100644
index 0000000..44aca98
--- /dev/null
+++ b/src/it/deployfile-release-skip-fail/invoker.properties
@@ -0,0 +1,17 @@
+# 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=package deploy:deploy-file
diff --git a/src/it/deployfile-release-skip-fail/pom.xml b/src/it/deployfile-release-skip-fail/pom.xml
new file mode 100644
index 0000000..ab4e9cb
--- /dev/null
+++ b/src/it/deployfile-release-skip-fail/pom.xml
@@ -0,0 +1,48 @@
+<?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.deploy.its</groupId>
+    <artifactId>deployfile-release-skip-fail</artifactId>
+    <version>1.0</version>
+
+    <description>
+        Test to verify that skip stops artifact deployment
+    </description>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-deploy-plugin</artifactId>
+                <version>@project.version@</version>
+                <configuration>
+                    <version>1.0</version>
+                    <skip>snapshots</skip>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/src/it/deployfile-release-skip-fail/test.properties b/src/it/deployfile-release-skip-fail/test.properties
new file mode 100644
index 0000000..4b138a5
--- /dev/null
+++ b/src/it/deployfile-release-skip-fail/test.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.
+file=target/deployfile-release-skip-fail-1.0.jar
+url=file:target/repo
\ No newline at end of file
diff --git a/src/it/deployfile-release-skip-fail/verify.groovy b/src/it/deployfile-release-skip-fail/verify.groovy
new file mode 100644
index 0000000..17fe436
--- /dev/null
+++ b/src/it/deployfile-release-skip-fail/verify.groovy
@@ -0,0 +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.
+ */
+
+assert new File(basedir, "target/repo/org/apache/maven/plugins/deploy/its/deployfile-release-skip-fail/1.0/deployfile-release-skip-fail-1.0.jar").exists()
+File deployedPom = new File(basedir, "target/repo/org/apache/maven/plugins/deploy/its/deployfile-release-skip-fail/1.0/deployfile-release-skip-fail-1.0.pom")
+assert deployedPom.exists()
+
+File buildLog = new File(basedir, 'build.log')
+assert buildLog.exists()
+assert buildLog.text.contains("[DEBUG] Using META-INF/maven/org.apache.maven.plugins.deploy.its/deployfile-release-skip-fail/pom.xml as pomFile")
diff --git a/src/it/deployfile-release-skip/invoker.properties b/src/it/deployfile-release-skip/invoker.properties
new file mode 100644
index 0000000..44aca98
--- /dev/null
+++ b/src/it/deployfile-release-skip/invoker.properties
@@ -0,0 +1,17 @@
+# 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=package deploy:deploy-file
diff --git a/src/it/deployfile-release-skip/pom.xml b/src/it/deployfile-release-skip/pom.xml
new file mode 100644
index 0000000..3a02d9a
--- /dev/null
+++ b/src/it/deployfile-release-skip/pom.xml
@@ -0,0 +1,48 @@
+<?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.deploy.its</groupId>
+    <artifactId>deployfile-release-skip</artifactId>
+    <version>1.0</version>
+
+    <description>
+        Test to verify that skip stops artifact deployment
+    </description>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-deploy-plugin</artifactId>
+                <version>@project.version@</version>
+                <configuration>
+                    <version>1.0</version>
+                    <skip>releases</skip>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/src/it/deployfile-release-skip/test.properties b/src/it/deployfile-release-skip/test.properties
new file mode 100644
index 0000000..2895346
--- /dev/null
+++ b/src/it/deployfile-release-skip/test.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.
+file=target/deployfile-release-skip-1.0.jar
+url=file:target/repo
\ No newline at end of file
diff --git a/src/it/deployfile-release-skip/verify.groovy b/src/it/deployfile-release-skip/verify.groovy
new file mode 100644
index 0000000..c476e40
--- /dev/null
+++ b/src/it/deployfile-release-skip/verify.groovy
@@ -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.
+ */
+
+assert !new File(basedir, "target/repo/org/apache/maven/plugins/deploy/its/deployfile-release-skip").exists()
+
+File buildLog = new File(basedir, 'build.log')
+assert buildLog.exists()
+assert !buildLog.text.contains("[DEBUG] Using META-INF/maven/org.apache.maven.plugins.deploy.its/deployfile-release-skip/pom.xml as pomFile")
diff --git a/src/it/deployfile-skip-fail/invoker.properties b/src/it/deployfile-skip-fail/invoker.properties
new file mode 100644
index 0000000..44aca98
--- /dev/null
+++ b/src/it/deployfile-skip-fail/invoker.properties
@@ -0,0 +1,17 @@
+# 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=package deploy:deploy-file
diff --git a/src/it/deployfile-skip-fail/pom.xml b/src/it/deployfile-skip-fail/pom.xml
new file mode 100644
index 0000000..ae7aa25
--- /dev/null
+++ b/src/it/deployfile-skip-fail/pom.xml
@@ -0,0 +1,47 @@
+<?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.deploy.its</groupId>
+    <artifactId>deployfile-skip-fail</artifactId>
+    <version>1.0</version>
+
+    <description>
+        Test to verify that skip stops artifact deployment
+    </description>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-deploy-plugin</artifactId>
+                <version>@project.version@</version>
+                <configuration>
+                    <skip>false</skip>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/src/it/deployfile-skip-fail/test.properties b/src/it/deployfile-skip-fail/test.properties
new file mode 100644
index 0000000..f93ace8
--- /dev/null
+++ b/src/it/deployfile-skip-fail/test.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.
+file=target/deployfile-skip-fail-1.0.jar
+url=file:target/repo
\ No newline at end of file
diff --git a/src/it/deployfile-skip-fail/verify.groovy b/src/it/deployfile-skip-fail/verify.groovy
new file mode 100644
index 0000000..35e8db1
--- /dev/null
+++ b/src/it/deployfile-skip-fail/verify.groovy
@@ -0,0 +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.
+ */
+
+assert new File(basedir, "target/repo/org/apache/maven/plugins/deploy/its/deployfile-skip-fail/1.0/deployfile-skip-fail-1.0.jar").exists()
+File deployedPom = new File(basedir, "target/repo/org/apache/maven/plugins/deploy/its/deployfile-skip-fail/1.0/deployfile-skip-fail-1.0.pom")
+assert deployedPom.exists()
+
+File buildLog = new File(basedir, 'build.log')
+assert buildLog.exists()
+assert buildLog.text.contains("[DEBUG] Using META-INF/maven/org.apache.maven.plugins.deploy.its/deployfile-skip-fail/pom.xml as pomFile")
diff --git a/src/it/deployfile-skip/invoker.properties b/src/it/deployfile-skip/invoker.properties
new file mode 100644
index 0000000..44aca98
--- /dev/null
+++ b/src/it/deployfile-skip/invoker.properties
@@ -0,0 +1,17 @@
+# 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=package deploy:deploy-file
diff --git a/src/it/deployfile-skip/pom.xml b/src/it/deployfile-skip/pom.xml
new file mode 100644
index 0000000..530a84e
--- /dev/null
+++ b/src/it/deployfile-skip/pom.xml
@@ -0,0 +1,47 @@
+<?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.deploy.its</groupId>
+    <artifactId>deployfile-skip</artifactId>
+    <version>1.0</version>
+
+    <description>
+        Test to verify that skip stops artifact deployment
+    </description>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-deploy-plugin</artifactId>
+                <version>@project.version@</version>
+                <configuration>
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/src/it/deployfile-skip/test.properties b/src/it/deployfile-skip/test.properties
new file mode 100644
index 0000000..b1cd011
--- /dev/null
+++ b/src/it/deployfile-skip/test.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.
+file=target/deployfile-skip-1.0.jar
+url=file:target/repo
\ No newline at end of file
diff --git a/src/it/deployfile-skip/verify.groovy b/src/it/deployfile-skip/verify.groovy
new file mode 100644
index 0000000..618ff5e
--- /dev/null
+++ b/src/it/deployfile-skip/verify.groovy
@@ -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.
+ */
+
+assert !new File(basedir, "target/repo/org/apache/maven/plugins/deploy/its/deployfile-skip").exists()
+
+File buildLog = new File(basedir, 'build.log')
+assert buildLog.exists()
+assert !buildLog.text.contains("[DEBUG] Using META-INF/maven/org.apache.maven.plugins.deploy.its/deployfile-skip/pom.xml as pomFile")
diff --git a/src/it/deployfile-snapshot-skip-fail/invoker.properties b/src/it/deployfile-snapshot-skip-fail/invoker.properties
new file mode 100644
index 0000000..44aca98
--- /dev/null
+++ b/src/it/deployfile-snapshot-skip-fail/invoker.properties
@@ -0,0 +1,17 @@
+# 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=package deploy:deploy-file
diff --git a/src/it/deployfile-snapshot-skip-fail/pom.xml b/src/it/deployfile-snapshot-skip-fail/pom.xml
new file mode 100644
index 0000000..aba1a40
--- /dev/null
+++ b/src/it/deployfile-snapshot-skip-fail/pom.xml
@@ -0,0 +1,48 @@
+<?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.deploy.its</groupId>
+    <artifactId>deployfile-snapshot-skip-fail</artifactId>
+    <version>1.0</version>
+
+    <description>
+        Test to verify that skip stops artifact deployment
+    </description>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-deploy-plugin</artifactId>
+                <version>@project.version@</version>
+                <configuration>
+                    <version>1.0-SNAPSHOT</version>
+                    <skip>releases</skip>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/src/it/deployfile-snapshot-skip-fail/test.properties b/src/it/deployfile-snapshot-skip-fail/test.properties
new file mode 100644
index 0000000..24b7193
--- /dev/null
+++ b/src/it/deployfile-snapshot-skip-fail/test.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.
+file=target/deployfile-snapshot-skip-fail-1.0.jar
+url=file:target/repo
\ No newline at end of file
diff --git a/src/it/deployfile-snapshot-skip-fail/verify.groovy b/src/it/deployfile-snapshot-skip-fail/verify.groovy
new file mode 100644
index 0000000..21ef0c7
--- /dev/null
+++ b/src/it/deployfile-snapshot-skip-fail/verify.groovy
@@ -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.
+ */
+
+File deployedDir = new File(basedir, "target/repo/org/apache/maven/plugins/deploy/its/deployfile-snapshot-skip-fail/1.0-SNAPSHOT")
+assert deployedDir.exists()
+assert deployedDir.isDirectory()
+assert deployedDir.listFiles({ File file, String name -> name.matches("deployfile-snapshot-skip-fail-1\\.0-.*\\.jar") } as FilenameFilter).length == 1
+assert deployedDir.listFiles({ File file, String name -> name.matches("deployfile-snapshot-skip-fail-1\\.0-.*\\.pom") } as FilenameFilter).length == 1
+
+File buildLog = new File(basedir, 'build.log')
+assert buildLog.exists()
+assert buildLog.text.contains("[DEBUG] Using META-INF/maven/org.apache.maven.plugins.deploy.its/deployfile-snapshot-skip-fail/pom.xml as pomFile")
diff --git a/src/it/deployfile-snapshot-skip/invoker.properties b/src/it/deployfile-snapshot-skip/invoker.properties
new file mode 100644
index 0000000..44aca98
--- /dev/null
+++ b/src/it/deployfile-snapshot-skip/invoker.properties
@@ -0,0 +1,17 @@
+# 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=package deploy:deploy-file
diff --git a/src/it/deployfile-snapshot-skip/pom.xml b/src/it/deployfile-snapshot-skip/pom.xml
new file mode 100644
index 0000000..cbedfd8
--- /dev/null
+++ b/src/it/deployfile-snapshot-skip/pom.xml
@@ -0,0 +1,48 @@
+<?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.deploy.its</groupId>
+    <artifactId>deployfile-snapshot-skip</artifactId>
+    <version>1.0</version>
+
+    <description>
+        Test to verify that skip stops artifact deployment
+    </description>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-deploy-plugin</artifactId>
+                <version>@project.version@</version>
+                <configuration>
+                    <version>1.0-SNAPSHOT</version>
+                    <skip>snapshots</skip>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/src/it/deployfile-snapshot-skip/test.properties b/src/it/deployfile-snapshot-skip/test.properties
new file mode 100644
index 0000000..b33c818
--- /dev/null
+++ b/src/it/deployfile-snapshot-skip/test.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.
+file=target/deployfile-snapshot-skip-1.0.jar
+url=file:target/repo
\ No newline at end of file
diff --git a/src/it/deployfile-snapshot-skip/verify.groovy b/src/it/deployfile-snapshot-skip/verify.groovy
new file mode 100644
index 0000000..ab46c59
--- /dev/null
+++ b/src/it/deployfile-snapshot-skip/verify.groovy
@@ -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.
+ */
+
+assert !new File(basedir, "target/repo/org/apache/maven/plugins/deploy/its/deployfile-snapshot-skip").exists()
+
+File buildLog = new File(basedir, 'build.log')
+assert buildLog.exists()
+assert !buildLog.text.contains("[DEBUG] Using META-INF/maven/org.apache.maven.plugins.deploy.its/deployfile-snapshot-skip/pom.xml as pomFile")
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 11bb285..7f27f39 100644
--- a/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
+++ b/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java
@@ -33,6 +33,7 @@ import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.regex.Pattern;
 
+import org.apache.maven.artifact.ArtifactUtils;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Parent;
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
@@ -173,6 +174,20 @@ public class DeployFileMojo
     @Parameter( property = "files" )
     private String files;
 
+    /**
+     * Set this to 'true' to bypass artifact deploy
+     * It's not a real boolean as it can have more than 2 values:
+     * <ul>
+     *     <li><code>true</code>: will skip as usual</li>
+     *     <li><code>releases</code>: will skip if current version of the project is a release</li>
+     *     <li><code>snapshots</code>: will skip if current version of the project is a snapshot</li>
+     *     <li>any other values will be considered as <code>false</code></li>
+     * </ul>
+     * @since 3.1.0
+     */
+    @Parameter( property = "maven.deploy.file.skip", defaultValue = "false" )
+    private String skip = Boolean.FALSE.toString();
+
     void initProperties()
         throws MojoExecutionException
     {
@@ -235,6 +250,15 @@ public class DeployFileMojo
     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" );
+            return;
+        }
+
         if ( !file.exists() )
         {
             throw new MojoExecutionException( file.getPath() + " not found." );
diff --git a/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java b/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java
index 0700dfb..deb9fa3 100644
--- a/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java
@@ -114,6 +114,8 @@ public class DeployFileMojoTest
 
         String url = (String) getVariableValueFromObject( mojo, "url" );
 
+        String skip = (String) getVariableValueFromObject( mojo, "skip" );
+
         assertEquals( "org.apache.maven.test", groupId );
 
         assertEquals( "maven-deploy-file-test", artifactId );
@@ -122,6 +124,8 @@ public class DeployFileMojoTest
 
         assertEquals( "jar", packaging );
 
+        assertEquals( "snapshots", skip );
+
         assertTrue( file.exists() );
 
         assertEquals( "deploy-test", repositoryId );
diff --git a/src/test/resources/unit/deploy-file-test/plugin-config.xml b/src/test/resources/unit/deploy-file-test/plugin-config.xml
index 67b98a1..9f52255 100644
--- a/src/test/resources/unit/deploy-file-test/plugin-config.xml
+++ b/src/test/resources/unit/deploy-file-test/plugin-config.xml
@@ -32,6 +32,7 @@ under the License.
           <url>file://${basedir}/target/remote-repo/deploy-file-test</url>
           <description>POM was created from deploy:deploy-file</description>
           <generatePom>true</generatePom>
+          <skip>snapshots</skip>
         </configuration>
       </plugin>
     </plugins>