You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2020/12/24 20:37:15 UTC
[maven-deploy-plugin] 01/01: Revert "[MDEPLOY-231] - Move checksum
generation from install to deploy plugin"
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch MDEPLOY-282
in repository https://gitbox.apache.org/repos/asf/maven-deploy-plugin.git
commit 4fdec002e98602356b71583f11de1162ccecd70e
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Thu Dec 24 21:37:00 2020 +0100
Revert "[MDEPLOY-231] - Move checksum generation from install to deploy plugin"
This reverts commit 83b2d51cb3427a54ea465ff836c68da18accd426.
---
pom.xml | 5 -
src/it/attach-jar-checksum-release/pom.xml | 103 ---------------------
src/it/attach-jar-checksum-release/setup.bsh | 29 ------
src/it/attach-jar-checksum-release/verify.groovy | 64 -------------
src/it/attach-jar-checksum-snapshot/pom.xml | 102 --------------------
src/it/attach-jar-checksum-snapshot/setup.bsh | 29 ------
src/it/attach-jar-checksum-snapshot/verify.groovy | 95 -------------------
.../org/apache/maven/plugins/deploy/Utils.java | 63 -------------
8 files changed, 490 deletions(-)
diff --git a/pom.xml b/pom.xml
index 94af895..1033d18 100644
--- a/pom.xml
+++ b/pom.xml
@@ -201,14 +201,9 @@ under the License.
<postBuildHookScript>verify</postBuildHookScript>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<settingsFile>src/it/settings.xml</settingsFile>
- <addTestClassPath>true</addTestClassPath>
<goals>
<goal>deploy</goal>
</goals>
- <properties>
- <!-- e.g. ensure that Java7 picks up TLSv1.2 when connecting with Central -->
- <https.protocols>${https.protocols}</https.protocols>
- </properties>
</configuration>
</plugin>
</plugins>
diff --git a/src/it/attach-jar-checksum-release/pom.xml b/src/it/attach-jar-checksum-release/pom.xml
deleted file mode 100644
index bda659d..0000000
--- a/src/it/attach-jar-checksum-release/pom.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-<?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.its.deploy.ajc</groupId>
- <artifactId>test</artifactId>
- <version>1.0</version>
- <packaging>jar</packaging>
-
- <description>
- This test has been moved from maven-install-plugin to maven-deploy-plugin.
- Tests the installation of a simple snapshot JAR with an attached artifact and checksums
- </description>
-
- <properties>
- <maven.test.skip>true</maven.test.skip>
- </properties>
- <distributionManagement>
- <repository>
- <id>it</id>
- <url>file:///${basedir}/target/remoterepo</url>
- </repository>
- </distributionManagement>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.0.2</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>@project.version@</version>
- </plugin>
- <!--
- ! This is intentionally the old version which
- ! will not create checksums by default.
- ! We want to make sure that only maven-deploy-plugin
- ! will generate the checksums.
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <version>2.5.2</version>
- <configuration>
- <createChecksum>false</createChecksum>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.1</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.2</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <version>2.0.4</version>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.3.1</version>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/src/it/attach-jar-checksum-release/setup.bsh b/src/it/attach-jar-checksum-release/setup.bsh
deleted file mode 100644
index 4d73971..0000000
--- a/src/it/attach-jar-checksum-release/setup.bsh
+++ /dev/null
@@ -1,29 +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.
- */
-
-import java.io.*;
-import java.util.*;
-
-import org.codehaus.plexus.util.*;
-
-File file = new File( basedir, "org/apache/maven/its/deploy/ajc" );
-System.out.println( "Deleting " + file );
-FileUtils.deleteDirectory( file );
-
-return true;
diff --git a/src/it/attach-jar-checksum-release/verify.groovy b/src/it/attach-jar-checksum-release/verify.groovy
deleted file mode 100644
index ac362f8..0000000
--- a/src/it/attach-jar-checksum-release/verify.groovy
+++ /dev/null
@@ -1,64 +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.
- */
-
-import java.io.*;
-import java.util.*;
-
-import org.apache.maven.plugins.deploy.Utils;
-
-def paths =
-[
- "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.pom",
- "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.pom.md5",
- "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.pom.sha1",
- "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.jar",
- "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.jar.md5",
- "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.jar.sha1",
- "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar",
- "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar.md5",
- "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar.sha1",
- "org/apache/maven/its/deploy/ajc/test/maven-metadata.xml",
- "org/apache/maven/its/deploy/ajc/test/maven-metadata.xml.md5",
- "org/apache/maven/its/deploy/ajc/test/maven-metadata.xml.sha1",
-]
-
-def cksumToCheckPaths = [
- "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.pom",
- "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.jar",
- "org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar"
-]
-
-// Check if artifacts have been uploaded to remote with checksums
-def repository = new File (basedir, "target/remoterepo" )
-paths.each { path ->
- //File file = new File( localRepositoryPath, path );
- File file = new File( repository, path );
- println "Checking for existence of ${file}"
- if ( !file.isFile() )
- {
- throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() );
- }
- if ( cksumToCheckPaths.contains( path ) )
- {
- println "Verifying ${file}"
- Utils.verifyChecksum( file );
- }
-}
-
-return true;
diff --git a/src/it/attach-jar-checksum-snapshot/pom.xml b/src/it/attach-jar-checksum-snapshot/pom.xml
deleted file mode 100644
index 89ddce7..0000000
--- a/src/it/attach-jar-checksum-snapshot/pom.xml
+++ /dev/null
@@ -1,102 +0,0 @@
-<?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.its.deploy.ajc</groupId>
- <artifactId>test</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>jar</packaging>
-
- <description>
- Tests the deployment of a simple SNAPSHOT JAR with an attached artifact and checksums
- </description>
-
- <properties>
- <maven.test.skip>true</maven.test.skip>
- </properties>
- <distributionManagement>
- <repository>
- <id>it</id>
- <url>file:///${basedir}/target/remoterepo</url>
- </repository>
- </distributionManagement>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.0.2</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>@project.version@</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.1</version>
- </plugin>
- <!--
- ! This is intentionally the old version which
- ! will not create checksums by default.
- ! We want to make sure that only maven-deploy-plugin
- ! will generate the checksums.
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <version>2.5.2</version>
- <configuration>
- <createChecksum>false</createChecksum>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.2</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <version>2.0.4</version>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.3.1</version>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/src/it/attach-jar-checksum-snapshot/setup.bsh b/src/it/attach-jar-checksum-snapshot/setup.bsh
deleted file mode 100644
index 7d54f90..0000000
--- a/src/it/attach-jar-checksum-snapshot/setup.bsh
+++ /dev/null
@@ -1,29 +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.
- */
-
-import java.io.*;
-import java.util.*;
-
-import org.codehaus.plexus.util.*;
-
-File file = new File( basedir, "target/remoterepo/org/apache/maven/its/deploy/ajc" );
-System.out.println( "Deleting " + file );
-FileUtils.deleteDirectory( file );
-
-return true;
diff --git a/src/it/attach-jar-checksum-snapshot/verify.groovy b/src/it/attach-jar-checksum-snapshot/verify.groovy
deleted file mode 100644
index 0a4a14f..0000000
--- a/src/it/attach-jar-checksum-snapshot/verify.groovy
+++ /dev/null
@@ -1,95 +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.
- */
-
-import org.apache.maven.plugins.deploy.Utils;
-
-def pathsInTargetDirectory = [
- "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.pom",
- "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.pom\\.md5",
- "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.pom\\.sha1",
- "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.jar",
- "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.jar\\.md5",
- "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.jar\\.sha1",
- "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\-sources\\.jar",
- "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\-sources\\.jar\\.md5",
- "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\-sources\\.jar\\.sha1",
- //The following files will be generated. But they can't be check for the checksums
- //cause they contain timestamps which means they change everytime.
- "maven\\-metadata\\.xml",
- "maven\\-metadata\\.xml\\.md5",
- "maven\\-metadata\\.xml\\.sha1",
-]
-
-def checkSumsToCheckPaths = [
- "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.pom",
- "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.jar",
- "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\-sources\\.jar",
-]
-
-// All files are being deployed to that location. See pom.xml
-def repository = new File (basedir, "target/remoterepo/org/apache/maven/its/deploy/ajc/test/1.0-SNAPSHOT" )
-
-// Read all files from the target directory.
-def filesInDirectory = []
-repository.eachFile() { file ->
- filesInDirectory << file.getName()
-}
-
-println "Size: ${filesInDirectory.size()} / ${pathsInTargetDirectory.size()}"
-
-// First Step is to check the number of files found in directory against
-// the number of files we expect to find.
-if (filesInDirectory.size() != pathsInTargetDirectory.size()) {
- throw new Exception( "The number of files in filesInDirectory and the number of files in pathsInTargetDirectory are not equal" );
-}
-
-// The following will check for the existence of all given
-// files based on the given regular expressions.
-// This is needed cause the time stamp in the file name
-// changes each time this test will be running.
-filesInDirectory.each { existingFile ->
- def result = false
- pathsInTargetDirectory.each { searchItem ->
- def expected = existingFile ==~ searchItem
- println "existingFile: ${existingFile} ${searchItem} expeced:${expected}"
- if (expected) {
- result = true
- }
- }
-
- if (!result) {
- throw new FileNotFoundException ( "Missing: ${existingFile}" )
- }
-}
-
-// The following will check the existing checksums.
-filesInDirectory.each { existingFile ->
- def result = false
- checkSumsToCheckPaths.each { searchItem ->
- //search for the file name pattern..
- def expected = existingFile ==~ searchItem
- if (expected) {
- println "Verifying ${existingFile}"
- Utils.verifyChecksum( new File(repository, existingFile) );
- }
- }
-}
-
-return true;
-
diff --git a/src/test/java/org/apache/maven/plugins/deploy/Utils.java b/src/test/java/org/apache/maven/plugins/deploy/Utils.java
deleted file mode 100644
index 4df7442..0000000
--- a/src/test/java/org/apache/maven/plugins/deploy/Utils.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.apache.maven.plugins.deploy;
-
-/*
- * 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.
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.sonatype.aether.util.ChecksumUtils;
-
-/**
- * A utility class to assist testing.
- *
- * @author Benjamin Bentmann
- */
-public class Utils
-{
-
- public static final List<String> CHECKSUM_ALGORITHMS = Arrays.asList( "MD5", "SHA-1" );
-
- /**
- * Verifies the checksum files in the local repo for the given file.
- *
- * @param file The file to verify its checksum with, must not be <code>null</code>.
- * @throws MojoExecutionException In case the checksums were incorrect.
- * @throws IOException If the files couldn't be read.
- */
- public static void verifyChecksum( File file )
- throws MojoExecutionException, IOException
- {
- Map<String, Object> checksums = ChecksumUtils.calc( file, CHECKSUM_ALGORITHMS );
- for ( Map.Entry<String, Object> entry : checksums.entrySet() )
- {
- File cksumFile = new File( file + "." + entry.getKey().toLowerCase().replace( "-", "" ) );
- String actualChecksum = ChecksumUtils.read( cksumFile );
- if ( !actualChecksum.equals( entry.getValue() ) )
- {
- throw new MojoExecutionException( "Incorrect " + entry.getKey() + " checksum for file: " + file );
- }
- }
- }
-
-}