Detatch tar.gz/zip related artifacts from deployment
Project: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/commit/f0c5441e Tree: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/tree/f0c5441e Diff: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/diff/f0c5441e Branch: refs/heads/master Commit: f0c5441e4240478fea6500c0ef2dc95b86fe9ec5 Parents: 9f86ea7 Author: Rob Tompkins <chtom...@gmail.com> Authored: Sat Dec 23 14:04:03 2017 -0500 Committer: Rob Tompkins <chtom...@gmail.com> Committed: Sat Dec 23 14:04:03 2017 -0500 ---------------------------------------------------------------------- pom.xml | 5 ++ src/it/settings.xml | 77 ++++++++++++++++++++ .../mojos/AbstractCommonsBuildPluginMojo.java | 28 ------- .../plugin/mojos/CommonsBuildPluginMojo.java | 32 -------- .../build/plugin/mojos/package-info.java | 17 ----- .../commons/build/plugin/package-info.java | 17 ----- .../mojos/AbstractCommonsReleasePluginMojo.java | 28 +++++++ .../plugin/mojos/CommonsReleasePluginMojo.java | 68 +++++++++++++++++ .../release/plugin/mojos/package-info.java | 17 +++++ .../commons/release/plugin/package-info.java | 17 +++++ src/test-project/pom.xml | 56 -------------- .../commons/build/plugin/package-info.java | 17 ----- .../commons/release/plugin/package-info.java | 17 +++++ 13 files changed, 229 insertions(+), 167 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/f0c5441e/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 0a25031..6e01876 100644 --- a/pom.xml +++ b/pom.xml @@ -91,6 +91,11 @@ <artifactId>maven-plugin-annotations</artifactId> <version>3.5</version> </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-project</artifactId> + <version>2.2.1</version> + </dependency> </dependencies> <build> http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/f0c5441e/src/it/settings.xml ---------------------------------------------------------------------- diff --git a/src/it/settings.xml b/src/it/settings.xml new file mode 100644 index 0000000..8912a7c --- /dev/null +++ b/src/it/settings.xml @@ -0,0 +1,77 @@ +<?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> + <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> + <repository> + <id>apache.snapshot</id> + <url>https://repository.apache.org/content/groups/snapshots-group/</url> + <releases> + <enabled>false</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> + <mirrors> + <mirror> + <id>local-tlc</id> + <mirrorOf>tlc</mirrorOf> + <url>@localRepositoryUrl@</url> + </mirror> + <mirror> + <id>apache-plugin-snapshots-new</id> + <mirrorOf>apache-plugin-snapshots</mirrorOf> + <url>https://repository.apache.org/content/groups/snapshots-group/</url> + </mirror> + </mirrors> +</settings> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/f0c5441e/src/main/java/org/apache/commons/build/plugin/mojos/AbstractCommonsBuildPluginMojo.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/build/plugin/mojos/AbstractCommonsBuildPluginMojo.java b/src/main/java/org/apache/commons/build/plugin/mojos/AbstractCommonsBuildPluginMojo.java deleted file mode 100644 index ad26d7c..0000000 --- a/src/main/java/org/apache/commons/build/plugin/mojos/AbstractCommonsBuildPluginMojo.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.commons.build.plugin.mojos; - -import org.apache.maven.plugin.AbstractMojo; - -/** - * Contains the logging mechanics for the commons-build-plugin. - * - * @author chtompki - * @since 1.0 - */ -public abstract class AbstractCommonsBuildPluginMojo extends AbstractMojo { -} http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/f0c5441e/src/main/java/org/apache/commons/build/plugin/mojos/CommonsBuildPluginMojo.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/build/plugin/mojos/CommonsBuildPluginMojo.java b/src/main/java/org/apache/commons/build/plugin/mojos/CommonsBuildPluginMojo.java deleted file mode 100644 index ae75b57..0000000 --- a/src/main/java/org/apache/commons/build/plugin/mojos/CommonsBuildPluginMojo.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.commons.build.plugin.mojos; - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugins.annotations.Mojo; - -/** - * @author chtompki - * @since 1.0 - */ -@Mojo( name = "test", threadSafe = true ) -public class CommonsBuildPluginMojo extends AbstractMojo { - - public void execute() { - getLog().info("Hello World"); - } -} http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/f0c5441e/src/main/java/org/apache/commons/build/plugin/mojos/package-info.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/build/plugin/mojos/package-info.java b/src/main/java/org/apache/commons/build/plugin/mojos/package-info.java deleted file mode 100644 index 2f50937..0000000 --- a/src/main/java/org/apache/commons/build/plugin/mojos/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * 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.commons.build.plugin.mojos; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/f0c5441e/src/main/java/org/apache/commons/build/plugin/package-info.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/build/plugin/package-info.java b/src/main/java/org/apache/commons/build/plugin/package-info.java deleted file mode 100644 index b3a065a..0000000 --- a/src/main/java/org/apache/commons/build/plugin/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * 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.commons.build.plugin; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/f0c5441e/src/main/java/org/apache/commons/release/plugin/mojos/AbstractCommonsReleasePluginMojo.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/release/plugin/mojos/AbstractCommonsReleasePluginMojo.java b/src/main/java/org/apache/commons/release/plugin/mojos/AbstractCommonsReleasePluginMojo.java new file mode 100644 index 0000000..7e78368 --- /dev/null +++ b/src/main/java/org/apache/commons/release/plugin/mojos/AbstractCommonsReleasePluginMojo.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.commons.release.plugin.mojos; + +import org.apache.maven.plugin.AbstractMojo; + +/** + * Contains the logging mechanics for the commons-release-plugin. + * + * @author chtompki + * @since 1.0 + */ +public abstract class AbstractCommonsReleasePluginMojo extends AbstractMojo { +} http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/f0c5441e/src/main/java/org/apache/commons/release/plugin/mojos/CommonsReleasePluginMojo.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsReleasePluginMojo.java b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsReleasePluginMojo.java new file mode 100644 index 0000000..bc45bc1 --- /dev/null +++ b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsReleasePluginMojo.java @@ -0,0 +1,68 @@ +/* + * 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.commons.release.plugin.mojos; + +import edu.emory.mathcs.backport.java.util.Collections; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.artifact.AttachedArtifact; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * @author chtompki + * @since 1.0 + * + * , defaultPhase = LifecyclePhase. + */ +@Mojo( name = "test", defaultPhase = LifecyclePhase.VERIFY, threadSafe = true) +public class CommonsReleasePluginMojo extends AbstractMojo { + + private static final Set<String> ARTIFACT_TYPES_TO_DETATCH; + static { + Set<String> hashSet = new HashSet<>(); + hashSet.add("zip"); + hashSet.add("tar.gz"); + hashSet.add("zip.asc"); + hashSet.add("tar.gz.asc"); + ARTIFACT_TYPES_TO_DETATCH = Collections.unmodifiableSet(hashSet); + } + + private List<AttachedArtifact> detatchedArtifacts = new ArrayList<>(); + + @Parameter( defaultValue = "${project}", required = true ) + private MavenProject project; + + public void execute() { + getLog().info("Detatching Assemblies"); + for (Object attachedArtifact : project.getAttachedArtifacts()) { + if (ARTIFACT_TYPES_TO_DETATCH.contains(((AttachedArtifact) attachedArtifact).getType())) { + detatchedArtifacts.add((AttachedArtifact) attachedArtifact); + } + } + for(AttachedArtifact artifactToRemove : detatchedArtifacts) { + project.getAttachedArtifacts().remove(artifactToRemove); + } + getLog().info(""); + } +} http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/f0c5441e/src/main/java/org/apache/commons/release/plugin/mojos/package-info.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/release/plugin/mojos/package-info.java b/src/main/java/org/apache/commons/release/plugin/mojos/package-info.java new file mode 100644 index 0000000..32828f0 --- /dev/null +++ b/src/main/java/org/apache/commons/release/plugin/mojos/package-info.java @@ -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. + */ +package org.apache.commons.release.plugin.mojos; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/f0c5441e/src/main/java/org/apache/commons/release/plugin/package-info.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/release/plugin/package-info.java b/src/main/java/org/apache/commons/release/plugin/package-info.java new file mode 100644 index 0000000..4852740 --- /dev/null +++ b/src/main/java/org/apache/commons/release/plugin/package-info.java @@ -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. + */ +package org.apache.commons.release.plugin; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/f0c5441e/src/test-project/pom.xml ---------------------------------------------------------------------- diff --git a/src/test-project/pom.xml b/src/test-project/pom.xml deleted file mode 100644 index a02076f..0000000 --- a/src/test-project/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - 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/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.commons</groupId> - <artifactId>test-project</artifactId> - <version>1.3</version> - <name>Test Project</name> - <description> - Commons Build Plugin Test Project. - </description> - - <url>http://commons.apache.org/commons-build-plugin/</url> - - <issueManagement> - <system>jira</system> - <url>http://issues.apache.org/jira/browse/COMMONSSITE</url> - </issueManagement> - - <build> - <plugins> - <plugin> - <groupId>org.apache.commons</groupId> - <artifactId>commons-build-plugin</artifactId> - <version>1.3</version> - <configuration> - <commons.release.name>${project.artifactId}-${commons.release.version}</commons.release.name> - <commons.jira.id>COMMONSSITE</commons.jira.id> - <commons.jira.pid>12310466</commons.jira.pid> - </configuration> - </plugin> - </plugins> - </build> - - <properties> - <commons.binary.suffix>-bin</commons.binary.suffix> - <commons.release.version>1.0</commons.release.version> - <commons.componentid>${project.artifactId}</commons.componentid> - </properties> - -</project> http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/f0c5441e/src/test/java/org/apache/commons/build/plugin/package-info.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/build/plugin/package-info.java b/src/test/java/org/apache/commons/build/plugin/package-info.java deleted file mode 100644 index b3a065a..0000000 --- a/src/test/java/org/apache/commons/build/plugin/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * 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.commons.build.plugin; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/f0c5441e/src/test/java/org/apache/commons/release/plugin/package-info.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/release/plugin/package-info.java b/src/test/java/org/apache/commons/release/plugin/package-info.java new file mode 100644 index 0000000..4852740 --- /dev/null +++ b/src/test/java/org/apache/commons/release/plugin/package-info.java @@ -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. + */ +package org.apache.commons.release.plugin; \ No newline at end of file