Skip to content

Commit 83b2d51

Browse files
committed
[MDEPLOY-231] - Move checksum generation from install to deploy plugin
1 parent 41a40f6 commit 83b2d51

File tree

12 files changed

+507
-11
lines changed

12 files changed

+507
-11
lines changed

pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ under the License.
9191
<dependency>
9292
<groupId>org.apache.maven.shared</groupId>
9393
<artifactId>maven-artifact-transfer</artifactId>
94-
<version>0.9.1</version>
94+
<version>0.10.0</version>
9595
</dependency>
9696
<!-- Upgrade of transitive dependency. -->
9797
<dependency>
@@ -185,9 +185,14 @@ under the License.
185185
<postBuildHookScript>verify</postBuildHookScript>
186186
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
187187
<settingsFile>src/it/settings.xml</settingsFile>
188+
<addTestClassPath>true</addTestClassPath>
188189
<goals>
189190
<goal>deploy</goal>
190191
</goals>
192+
<properties>
193+
<!-- e.g. ensure that Java7 picks up TLSv1.2 when connecting with Central -->
194+
<https.protocols>${https.protocols}</https.protocols>
195+
</properties>
191196
</configuration>
192197
</plugin>
193198
</plugins>
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
-->
21+
22+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
24+
<modelVersion>4.0.0</modelVersion>
25+
26+
<groupId>org.apache.maven.its.deploy.ajc</groupId>
27+
<artifactId>test</artifactId>
28+
<version>1.0</version>
29+
<packaging>jar</packaging>
30+
31+
<description>
32+
This test has been moved from maven-install-plugin to maven-deploy-plugin.
33+
Tests the installation of a simple snapshot JAR with an attached artifact and checksums
34+
</description>
35+
36+
<properties>
37+
<maven.test.skip>true</maven.test.skip>
38+
</properties>
39+
<distributionManagement>
40+
<repository>
41+
<id>it</id>
42+
<url>file:///${basedir}/target/remoterepo</url>
43+
</repository>
44+
</distributionManagement>
45+
46+
<build>
47+
<plugins>
48+
<plugin>
49+
<groupId>org.apache.maven.plugins</groupId>
50+
<artifactId>maven-compiler-plugin</artifactId>
51+
<version>2.0.2</version>
52+
</plugin>
53+
<plugin>
54+
<groupId>org.apache.maven.plugins</groupId>
55+
<artifactId>maven-deploy-plugin</artifactId>
56+
<version>@project.version@</version>
57+
</plugin>
58+
<!--
59+
! This is intentionally the old version which
60+
! will not create checksums by default.
61+
! We want to make sure that only maven-deploy-plugin
62+
! will generate the checksums.
63+
-->
64+
<plugin>
65+
<groupId>org.apache.maven.plugins</groupId>
66+
<artifactId>maven-install-plugin</artifactId>
67+
<version>2.5.2</version>
68+
<configuration>
69+
<createChecksum>false</createChecksum>
70+
</configuration>
71+
</plugin>
72+
<plugin>
73+
<groupId>org.apache.maven.plugins</groupId>
74+
<artifactId>maven-jar-plugin</artifactId>
75+
<version>2.1</version>
76+
</plugin>
77+
<plugin>
78+
<groupId>org.apache.maven.plugins</groupId>
79+
<artifactId>maven-resources-plugin</artifactId>
80+
<version>2.2</version>
81+
</plugin>
82+
<plugin>
83+
<groupId>org.apache.maven.plugins</groupId>
84+
<artifactId>maven-source-plugin</artifactId>
85+
<version>2.0.4</version>
86+
<executions>
87+
<execution>
88+
<id>attach-sources</id>
89+
<goals>
90+
<goal>jar</goal>
91+
</goals>
92+
</execution>
93+
</executions>
94+
</plugin>
95+
<plugin>
96+
<groupId>org.apache.maven.plugins</groupId>
97+
<artifactId>maven-surefire-plugin</artifactId>
98+
<version>2.3.1</version>
99+
</plugin>
100+
</plugins>
101+
</build>
102+
103+
</project>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import java.io.*;
21+
import java.util.*;
22+
23+
import org.codehaus.plexus.util.*;
24+
25+
File file = new File( basedir, "org/apache/maven/its/deploy/ajc" );
26+
System.out.println( "Deleting " + file );
27+
FileUtils.deleteDirectory( file );
28+
29+
return true;
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import java.io.*;
21+
import java.util.*;
22+
23+
import org.apache.maven.plugins.deploy.Utils;
24+
25+
def paths =
26+
[
27+
"org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.pom",
28+
"org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.pom.md5",
29+
"org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.pom.sha1",
30+
"org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.jar",
31+
"org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.jar.md5",
32+
"org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.jar.sha1",
33+
"org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar",
34+
"org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar.md5",
35+
"org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar.sha1",
36+
"org/apache/maven/its/deploy/ajc/test/maven-metadata.xml",
37+
"org/apache/maven/its/deploy/ajc/test/maven-metadata.xml.md5",
38+
"org/apache/maven/its/deploy/ajc/test/maven-metadata.xml.sha1",
39+
]
40+
41+
def cksumToCheckPaths = [
42+
"org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.pom",
43+
"org/apache/maven/its/deploy/ajc/test/1.0/test-1.0.jar",
44+
"org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar"
45+
]
46+
47+
// Check if artifacts have been uploaded to remote with checksums
48+
def repository = new File (basedir, "target/remoterepo" )
49+
paths.each { path ->
50+
//File file = new File( localRepositoryPath, path );
51+
File file = new File( repository, path );
52+
println "Checking for existence of ${file}"
53+
if ( !file.isFile() )
54+
{
55+
throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() );
56+
}
57+
if ( cksumToCheckPaths.contains( path ) )
58+
{
59+
println "Verifying ${file}"
60+
Utils.verifyChecksum( file );
61+
}
62+
}
63+
64+
return true;
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
-->
21+
22+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
24+
<modelVersion>4.0.0</modelVersion>
25+
26+
<groupId>org.apache.maven.its.deploy.ajc</groupId>
27+
<artifactId>test</artifactId>
28+
<version>1.0-SNAPSHOT</version>
29+
<packaging>jar</packaging>
30+
31+
<description>
32+
Tests the deployment of a simple SNAPSHOT JAR with an attached artifact and checksums
33+
</description>
34+
35+
<properties>
36+
<maven.test.skip>true</maven.test.skip>
37+
</properties>
38+
<distributionManagement>
39+
<repository>
40+
<id>it</id>
41+
<url>file:///${basedir}/target/remoterepo</url>
42+
</repository>
43+
</distributionManagement>
44+
45+
<build>
46+
<plugins>
47+
<plugin>
48+
<groupId>org.apache.maven.plugins</groupId>
49+
<artifactId>maven-compiler-plugin</artifactId>
50+
<version>2.0.2</version>
51+
</plugin>
52+
<plugin>
53+
<groupId>org.apache.maven.plugins</groupId>
54+
<artifactId>maven-deploy-plugin</artifactId>
55+
<version>@project.version@</version>
56+
</plugin>
57+
<plugin>
58+
<groupId>org.apache.maven.plugins</groupId>
59+
<artifactId>maven-jar-plugin</artifactId>
60+
<version>2.1</version>
61+
</plugin>
62+
<!--
63+
! This is intentionally the old version which
64+
! will not create checksums by default.
65+
! We want to make sure that only maven-deploy-plugin
66+
! will generate the checksums.
67+
-->
68+
<plugin>
69+
<groupId>org.apache.maven.plugins</groupId>
70+
<artifactId>maven-install-plugin</artifactId>
71+
<version>2.5.2</version>
72+
<configuration>
73+
<createChecksum>false</createChecksum>
74+
</configuration>
75+
</plugin>
76+
<plugin>
77+
<groupId>org.apache.maven.plugins</groupId>
78+
<artifactId>maven-resources-plugin</artifactId>
79+
<version>2.2</version>
80+
</plugin>
81+
<plugin>
82+
<groupId>org.apache.maven.plugins</groupId>
83+
<artifactId>maven-source-plugin</artifactId>
84+
<version>2.0.4</version>
85+
<executions>
86+
<execution>
87+
<id>attach-sources</id>
88+
<goals>
89+
<goal>jar</goal>
90+
</goals>
91+
</execution>
92+
</executions>
93+
</plugin>
94+
<plugin>
95+
<groupId>org.apache.maven.plugins</groupId>
96+
<artifactId>maven-surefire-plugin</artifactId>
97+
<version>2.3.1</version>
98+
</plugin>
99+
</plugins>
100+
</build>
101+
102+
</project>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import java.io.*;
21+
import java.util.*;
22+
23+
import org.codehaus.plexus.util.*;
24+
25+
File file = new File( basedir, "target/remoterepo/org/apache/maven/its/deploy/ajc" );
26+
System.out.println( "Deleting " + file );
27+
FileUtils.deleteDirectory( file );
28+
29+
return true;

0 commit comments

Comments
 (0)