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 00000000..44aca986 --- /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 00000000..ab4e9cb7 --- /dev/null +++ b/src/it/deployfile-release-skip-fail/pom.xml @@ -0,0 +1,48 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.deploy.its + deployfile-release-skip-fail + 1.0 + + + Test to verify that skip stops artifact deployment + + + + + + org.apache.maven.plugins + maven-deploy-plugin + @project.version@ + + 1.0 + snapshots + + + + + + 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 00000000..4b138a5c --- /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 00000000..17fe4366 --- /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 00000000..44aca986 --- /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 00000000..3a02d9af --- /dev/null +++ b/src/it/deployfile-release-skip/pom.xml @@ -0,0 +1,48 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.deploy.its + deployfile-release-skip + 1.0 + + + Test to verify that skip stops artifact deployment + + + + + + org.apache.maven.plugins + maven-deploy-plugin + @project.version@ + + 1.0 + releases + + + + + + diff --git a/src/it/deployfile-release-skip/test.properties b/src/it/deployfile-release-skip/test.properties new file mode 100644 index 00000000..28953464 --- /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 00000000..c476e408 --- /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 00000000..44aca986 --- /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 00000000..ae7aa257 --- /dev/null +++ b/src/it/deployfile-skip-fail/pom.xml @@ -0,0 +1,47 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.deploy.its + deployfile-skip-fail + 1.0 + + + Test to verify that skip stops artifact deployment + + + + + + org.apache.maven.plugins + maven-deploy-plugin + @project.version@ + + false + + + + + + diff --git a/src/it/deployfile-skip-fail/test.properties b/src/it/deployfile-skip-fail/test.properties new file mode 100644 index 00000000..f93ace8d --- /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 00000000..35e8db1f --- /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 00000000..44aca986 --- /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 00000000..530a84ec --- /dev/null +++ b/src/it/deployfile-skip/pom.xml @@ -0,0 +1,47 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.deploy.its + deployfile-skip + 1.0 + + + Test to verify that skip stops artifact deployment + + + + + + org.apache.maven.plugins + maven-deploy-plugin + @project.version@ + + true + + + + + + diff --git a/src/it/deployfile-skip/test.properties b/src/it/deployfile-skip/test.properties new file mode 100644 index 00000000..b1cd0111 --- /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 00000000..618ff5e4 --- /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 00000000..44aca986 --- /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 00000000..aba1a40d --- /dev/null +++ b/src/it/deployfile-snapshot-skip-fail/pom.xml @@ -0,0 +1,48 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.deploy.its + deployfile-snapshot-skip-fail + 1.0 + + + Test to verify that skip stops artifact deployment + + + + + + org.apache.maven.plugins + maven-deploy-plugin + @project.version@ + + 1.0-SNAPSHOT + releases + + + + + + 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 00000000..24b71939 --- /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 00000000..21ef0c72 --- /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 00000000..44aca986 --- /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 00000000..cbedfd8c --- /dev/null +++ b/src/it/deployfile-snapshot-skip/pom.xml @@ -0,0 +1,48 @@ + + + + + + 4.0.0 + + org.apache.maven.plugins.deploy.its + deployfile-snapshot-skip + 1.0 + + + Test to verify that skip stops artifact deployment + + + + + + org.apache.maven.plugins + maven-deploy-plugin + @project.version@ + + 1.0-SNAPSHOT + snapshots + + + + + + diff --git a/src/it/deployfile-snapshot-skip/test.properties b/src/it/deployfile-snapshot-skip/test.properties new file mode 100644 index 00000000..b33c8181 --- /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 00000000..ab46c590 --- /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 43044218..ecc20cc4 100644 --- a/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java +++ b/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java @@ -35,6 +35,7 @@ import java.util.regex.Pattern; import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.ArtifactUtils; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.model.Model; import org.apache.maven.model.Parent; @@ -208,6 +209,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: + * + * @since 2.4 + */ + @Parameter( property = "maven.deploy.file.skip", defaultValue = "false" ) + private String skip = Boolean.FALSE.toString(); + @Component private RepositoryManager repoManager; @@ -310,6 +325,15 @@ void initProperties() 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 ( uniqueVersion != null ) { throw new MojoExecutionException( "You are using 'uniqueVersion' which has been removed" 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 6c7064bb..9050ea16 100644 --- a/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/deploy/DeployFileMojoTest.java @@ -110,6 +110,8 @@ public void testBasicDeployFile() String url = (String) getVariableValueFromObject( mojo, "url" ); + String skip = (String) getVariableValueFromObject( mojo, "skip" ); + assertEquals( "org.apache.maven.test", groupId ); assertEquals( "maven-deploy-file-test", artifactId ); @@ -123,6 +125,8 @@ public void testBasicDeployFile() assertEquals( "deploy-test", repositoryId ); assertEquals( "file://" + getBasedir() + "/target/remote-repo/deploy-file-test", url ); + + assertEquals( "snapshots", skip ); mojo.execute(); 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 67b98a17..9f522553 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. file://${basedir}/target/remote-repo/deploy-file-test POM was created from deploy:deploy-file true + snapshots