Author: gboue
Date: Sat Nov 26 21:56:24 2016
New Revision: 1771515

URL: http://svn.apache.org/viewvc?rev=1771515&view=rev
Log:
[MENFORCER-247] Add a "require file checksum" rule
Submitted by: Lyubomyr Shaydariv

New RequireFileChecksum, rule that is non cacheable and inherits from 
AbstractNonCacheableEnforcerRule. This closes #18.

Added:
    
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireFileChecksum.java
   (with props)
    maven/enforcer/trunk/enforcer-rules/src/site/apt/requireFileChecksum.apt.vm 
  (with props)
    
maven/enforcer/trunk/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireFileChecksum.java
   (with props)
    
maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/require-file-checksum/
    
maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/require-file-checksum/LICENSE
    
maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/require-file-checksum/pom.xml
   (with props)
Modified:
    maven/enforcer/trunk/enforcer-rules/pom.xml
    maven/enforcer/trunk/enforcer-rules/src/site/apt/index.apt
    maven/enforcer/trunk/pom.xml

Modified: maven/enforcer/trunk/enforcer-rules/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/pom.xml?rev=1771515&r1=1771514&r2=1771515&view=diff
==============================================================================
--- maven/enforcer/trunk/enforcer-rules/pom.xml (original)
+++ maven/enforcer/trunk/enforcer-rules/pom.xml Sat Nov 26 21:56:24 2016
@@ -67,6 +67,10 @@
       <artifactId>commons-lang</artifactId>
     </dependency>
     <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.maven.enforcer</groupId>
       <artifactId>enforcer-api</artifactId>
     </dependency>

Added: 
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireFileChecksum.java
URL: 
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireFileChecksum.java?rev=1771515&view=auto
==============================================================================
--- 
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireFileChecksum.java
 (added)
+++ 
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireFileChecksum.java
 Sat Nov 26 21:56:24 2016
@@ -0,0 +1,146 @@
+package org.apache.maven.plugins.enforcer;
+
+/*
+ * 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.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
+import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
+import org.codehaus.plexus.util.IOUtil;
+
+/**
+ * Rule to validate a file to match the specified checksum.
+ *
+ * @author Edward Samson
+ * @author Lyubomyr Shaydariv
+ */
+public class RequireFileChecksum
+    extends AbstractNonCacheableEnforcerRule
+{
+
+    private File file;
+
+    private String checksum;
+
+    private String type;
+
+    public void execute( EnforcerRuleHelper helper )
+        throws EnforcerRuleException
+    {
+        if ( this.file == null )
+        {
+            throw new EnforcerRuleException( "Input file unspecified" );
+        }
+
+        if ( this.type == null )
+        {
+            throw new EnforcerRuleException( "Hash type unspecified" );
+        }
+
+        if ( this.checksum == null )
+        {
+            throw new EnforcerRuleException( "Checksum unspecified" );
+        }
+
+        InputStream inputStream = null;
+        try
+        {
+            if ( this.file.isDirectory() || !this.file.canRead() )
+            {
+                throw new EnforcerRuleException( "Cannot read file: " + 
this.file.getAbsolutePath() );
+            }
+
+            inputStream = new FileInputStream( this.file );
+            String checksum;
+            if ( "md5".equals( this.type ) )
+            {
+                checksum = DigestUtils.md5Hex( inputStream );
+            }
+            else if ( "sha1".equals( this.type ) )
+            {
+                checksum = DigestUtils.shaHex( inputStream );
+            }
+            else if ( "sha256".equals( this.type ) )
+            {
+                checksum = DigestUtils.sha256Hex( inputStream );
+            }
+            else if ( "sha384".equals( this.type ) )
+            {
+                checksum = DigestUtils.sha384Hex( inputStream );
+            }
+            else if ( "sha512".equals( this.type ) )
+            {
+                checksum = DigestUtils.sha512Hex( inputStream );
+            }
+            else
+            {
+                throw new EnforcerRuleException( "Unsupported hash type: " + 
this.type );
+            }
+            if ( !checksum.equalsIgnoreCase( this.checksum ) )
+            {
+                throw new EnforcerRuleException( this.type + " hash of " + 
this.file + " was " + checksum
+                    + " but expected " + this.checksum );
+            }
+        }
+        catch ( IOException e )
+        {
+            throw new EnforcerRuleException( "Unable to calculate checksum", e 
);
+        }
+        finally
+        {
+            IOUtil.close( inputStream );
+        }
+    }
+
+    /**
+     * The file to check.
+     *
+     * @param file file
+     */
+    public void setFile( File file )
+    {
+        this.file = file;
+    }
+
+    /**
+     * The expected checksum value.
+     *
+     * @param checksum checksum
+     */
+    public void setChecksum( String checksum )
+    {
+        this.checksum = checksum;
+    }
+
+    /**
+     * The checksum algorithm to use. Possible values: "md5", "sha1", 
"sha256", "sha384", "sha512".
+     *
+     * @param type algorithm
+     */
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+
+}

Propchange: 
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireFileChecksum.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireFileChecksum.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/enforcer/trunk/enforcer-rules/src/site/apt/index.apt
URL: 
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/site/apt/index.apt?rev=1771515&r1=1771514&r2=1771515&view=diff
==============================================================================
--- maven/enforcer/trunk/enforcer-rules/src/site/apt/index.apt (original)
+++ maven/enforcer/trunk/enforcer-rules/src/site/apt/index.apt Sat Nov 26 
21:56:24 2016
@@ -51,6 +51,8 @@ Standard Rules
   
   * {{{./requireEnvironmentVariable.html}requireEnvironmentVariable}} - 
enforces the existence of an environment variable
   
+  * {{{./requireFileChecksum.html}requireFileChecksum}} - enforces that the 
specified file has a certain checksum.
+  
   * {{{./requireFilesDontExist.html}requireFilesDontExist}} - enforces that 
the list of files does not exist.
   
   * {{{./requireFilesExist.html}requireFilesExist}} - enforces that the list 
of files does exist.

Added: 
maven/enforcer/trunk/enforcer-rules/src/site/apt/requireFileChecksum.apt.vm
URL: 
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/site/apt/requireFileChecksum.apt.vm?rev=1771515&view=auto
==============================================================================
--- maven/enforcer/trunk/enforcer-rules/src/site/apt/requireFileChecksum.apt.vm 
(added)
+++ maven/enforcer/trunk/enforcer-rules/src/site/apt/requireFileChecksum.apt.vm 
Sat Nov 26 21:56:24 2016
@@ -0,0 +1,98 @@
+~~ 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.
+
+  ------
+  Require Files Checksum
+  ------
+  Edward Samson, Lyubomyr Shaydariv
+  ------
+  February 2016
+  ------
+
+Require Files Checksum
+
+  This rule checks that the specified file has an given checksum.
+
+
+   The following parameters are supported by this rule:
+
+   * message - an optional message to the user if the rule fails.
+
+   * file - A file to check.
+
+   * checksum - Expected file checksum.
+
+   * type - Type of hashing algorithm to calculate the checksum. May be one of 
"md5", "sha1", "sha256", "sha384", or "sha512".
+
+   []
+
+
+  Sample Plugin Configuration:
+
++---+
+<project>
+  [...]
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>${project.version}</version>
+        <executions>
+          <execution>
+            <id>enforce-checksum</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <requireFileChecksum>
+                  <file>${project.build.outputDirectory}/foo.txt</file>
+                  <checksum>d41d8cd98f00b204e9800998ecf8427e</checksum>
+                  <type>md5</type>
+                </requireFileChecksum>
+                <requireFileChecksum>
+                  <file>${project.build.outputDirectory}/bar.txt</file>
+                  <checksum>da39a3ee5e6b4b0d3255bfef95601890afd80709</checksum>
+                  <type>sha1</type>
+                </requireFileChecksum>
+                <requireFileChecksum>
+                  <file>${project.build.outputDirectory}/baz.txt</file>
+                  
<checksum>e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855</checksum>
+                  <type>sha256</type>
+                </requireFileChecksum>
+                <requireFileChecksum>
+                  <file>${project.build.outputDirectory}/qux.txt</file>
+                  
<checksum>38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b</checksum>
+                  <type>sha384</type>
+                </requireFileChecksum>
+                <requireFileChecksum>
+                  <file>${project.build.outputDirectory}/quux.txt</file>
+                  
<checksum>cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e</checksum>
+                  <type>sha512</type>
+                </requireFileChecksum>
+              </rules>
+              <fail>true</fail>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  [...]
+</project>
++---+

Propchange: 
maven/enforcer/trunk/enforcer-rules/src/site/apt/requireFileChecksum.apt.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/enforcer/trunk/enforcer-rules/src/site/apt/requireFileChecksum.apt.vm
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/enforcer/trunk/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireFileChecksum.java
URL: 
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireFileChecksum.java?rev=1771515&view=auto
==============================================================================
--- 
maven/enforcer/trunk/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireFileChecksum.java
 (added)
+++ 
maven/enforcer/trunk/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireFileChecksum.java
 Sat Nov 26 21:56:24 2016
@@ -0,0 +1,233 @@
+package org.apache.maven.plugins.enforcer;
+
+/*
+ * 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 org.apache.maven.enforcer.rule.api.EnforcerRuleException;
+import org.codehaus.plexus.util.FileUtils;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.TemporaryFolder;
+
+/**
+ * Test the "RequireFileChecksum" rule
+ *
+ * @author Lyubomyr Shaydariv
+ */
+public class TestRequireFileChecksum
+{
+
+    private RequireFileChecksum rule = new RequireFileChecksum();
+
+    @Rule
+    public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+    @Rule
+    public ExpectedException expectedException = ExpectedException.none();
+
+    @Test
+    public void testFileChecksumMd5()
+        throws IOException, EnforcerRuleException
+    {
+        File f = temporaryFolder.newFile();
+        FileUtils.fileWrite( f, "message" );
+
+        rule.setFile( f );
+        rule.setChecksum( "78e731027d8fd50ed642340b7c9a63b3" );
+        rule.setType( "md5" );
+
+        rule.execute( EnforcerTestUtils.getHelper() );
+    }
+
+    @Test
+    public void testFileChecksumMd5UpperCase()
+        throws IOException, EnforcerRuleException
+    {
+        File f = temporaryFolder.newFile();
+        FileUtils.fileWrite( f, "message" );
+
+        rule.setFile( f );
+        rule.setChecksum( "78E731027D8FD50ED642340B7C9A63B3" );
+        rule.setType( "md5" );
+
+        rule.execute( EnforcerTestUtils.getHelper() );
+    }
+
+    @Test
+    public void testFileChecksumMd5NoFileFailure()
+        throws IOException, EnforcerRuleException
+    {
+        File f = new File( "foo" )
+        {
+            private static final long serialVersionUID = 6987790643999338089L;
+
+            @Override
+            public boolean canRead()
+            {
+                return false;
+            }
+        };
+
+        expectedException.expect( EnforcerRuleException.class );
+        expectedException.expectMessage( "Cannot read file: " + 
f.getAbsolutePath() );
+
+        rule.setFile( f );
+        rule.setChecksum( "78e731027d8fd50ed642340b7c9a63b3" );
+        rule.setType( "md5" );
+
+        rule.execute( EnforcerTestUtils.getHelper() );
+    }
+
+    @Test
+    public void testFileChecksumMd5GivenFileIsADirectoryFailure()
+        throws IOException, EnforcerRuleException
+    {
+        File f = temporaryFolder.newFolder();
+
+        expectedException.expect( EnforcerRuleException.class );
+        expectedException.expectMessage( "Cannot read file: " + 
f.getAbsolutePath() );
+
+        rule.setFile( f );
+        rule.setChecksum( "78e731027d8fd50ed642340b7c9a63b3" );
+        rule.setType( "md5" );
+
+        rule.execute( EnforcerTestUtils.getHelper() );
+    }
+
+    @Test
+    public void testFileChecksumMd5NoFileSpecifiedFailure()
+        throws IOException, EnforcerRuleException
+    {
+        expectedException.expect( EnforcerRuleException.class );
+        expectedException.expectMessage( "Input file unspecified" );
+
+        rule.setChecksum( "78e731027d8fd50ed642340b7c9a63b3" );
+        rule.setType( "md5" );
+
+        rule.execute( EnforcerTestUtils.getHelper() );
+    }
+
+    @Test
+    public void testFileChecksumMd5NoChecksumSpecifiedFailure()
+        throws IOException, EnforcerRuleException
+    {
+        expectedException.expect( EnforcerRuleException.class );
+        expectedException.expectMessage( "Checksum unspecified" );
+
+        File f = temporaryFolder.newFile();
+
+        rule.setFile( f );
+        rule.setType( "md5" );
+
+        rule.execute( EnforcerTestUtils.getHelper() );
+    }
+
+    @Test
+    public void testFileChecksumMd5NoTypeSpecifiedFailure()
+        throws IOException, EnforcerRuleException
+    {
+        expectedException.expect( EnforcerRuleException.class );
+        expectedException.expectMessage( "Hash type unspecified" );
+
+        File f = temporaryFolder.newFile();
+
+        rule.setFile( f );
+        rule.setChecksum( "78e731027d8fd50ed642340b7c9a63b3" );
+
+        rule.execute( EnforcerTestUtils.getHelper() );
+    }
+
+    @Test
+    public void testFileChecksumMd5ChecksumMismatchFailure()
+        throws IOException, EnforcerRuleException
+    {
+        File f = temporaryFolder.newFile();
+        FileUtils.fileWrite( f, "message" );
+
+        expectedException.expect( EnforcerRuleException.class );
+        expectedException.expectMessage( "md5 hash of " + f.getAbsolutePath()
+            + " was 78e731027d8fd50ed642340b7c9a63b3 but expected 
ffeeddccbbaa99887766554433221100" );
+
+        rule.setFile( f );
+        rule.setChecksum( "ffeeddccbbaa99887766554433221100" );
+        rule.setType( "md5" );
+
+        rule.execute( EnforcerTestUtils.getHelper() );
+    }
+
+    @Test
+    public void testFileChecksumSha1()
+        throws IOException, EnforcerRuleException
+    {
+        File f = temporaryFolder.newFile();
+        FileUtils.fileWrite( f, "message" );
+
+        rule.setFile( f );
+        rule.setChecksum( "6f9b9af3cd6e8b8a73c2cdced37fe9f59226e27d" );
+        rule.setType( "sha1" );
+
+        rule.execute( EnforcerTestUtils.getHelper() );
+    }
+
+    @Test
+    public void testFileChecksumSha256()
+        throws IOException, EnforcerRuleException
+    {
+        File f = temporaryFolder.newFile();
+        FileUtils.fileWrite( f, "message" );
+
+        rule.setFile( f );
+        rule.setChecksum( 
"ab530a13e45914982b79f9b7e3fba994cfd1f3fb22f71cea1afbf02b460c6d1d" );
+        rule.setType( "sha256" );
+
+        rule.execute( EnforcerTestUtils.getHelper() );
+    }
+
+    @Test
+    public void testFileChecksumSha384()
+        throws IOException, EnforcerRuleException
+    {
+        File f = temporaryFolder.newFile();
+        FileUtils.fileWrite( f, "message" );
+
+        rule.setFile( f );
+        rule.setChecksum( 
"353eb7516a27ef92e96d1a319712d84b902eaa828819e53a8b09af7028103a9978ba8feb6161e33c3619c5da4c4666a5"
 );
+        rule.setType( "sha384" );
+
+        rule.execute( EnforcerTestUtils.getHelper() );
+    }
+
+    @Test
+    public void testFileChecksumSha512()
+        throws IOException, EnforcerRuleException
+    {
+        File f = temporaryFolder.newFile();
+        FileUtils.fileWrite( f, "message" );
+
+        rule.setFile( f );
+        rule.setChecksum( 
"f8daf57a3347cc4d6b9d575b31fe6077e2cb487f60a96233c08cb479dbf31538cc915ec6d48bdbaa96ddc1a16db4f4f96f37276cfcb3510b8246241770d5952c"
 );
+        rule.setType( "sha512" );
+
+        rule.execute( EnforcerTestUtils.getHelper() );
+    }
+}

Propchange: 
maven/enforcer/trunk/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireFileChecksum.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/enforcer/trunk/enforcer-rules/src/test/java/org/apache/maven/plugins/enforcer/TestRequireFileChecksum.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/require-file-checksum/LICENSE
URL: 
http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/require-file-checksum/LICENSE?rev=1771515&view=auto
==============================================================================
--- 
maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/require-file-checksum/LICENSE
 (added)
+++ 
maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/require-file-checksum/LICENSE
 Sat Nov 26 21:56:24 2016
@@ -0,0 +1,16 @@
+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.

Added: 
maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/require-file-checksum/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/require-file-checksum/pom.xml?rev=1771515&view=auto
==============================================================================
--- 
maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/require-file-checksum/pom.xml
 (added)
+++ 
maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/require-file-checksum/pom.xml
 Sat Nov 26 21:56:24 2016
@@ -0,0 +1,78 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.enforcer</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+  <url>https://issues.apache.org/jira/browse/MENFORCER-247</url>
+  <description>
+  </description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>test</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <requireFileChecksum>
+                  <file>${project.basedir}/LICENSE</file>
+                  <type>md5</type>
+                  <checksum>7c5b65d44e8123e70d24d9eef17e9fa2</checksum>
+                </requireFileChecksum>
+                <requireFileChecksum>
+                  <file>${project.basedir}/LICENSE</file>
+                  <type>sha1</type>
+                  <checksum>278661cbaf6a1bcbd34e3877b6de0e8bd7097846</checksum>
+                </requireFileChecksum>
+                <requireFileChecksum>
+                  <file>${project.basedir}/LICENSE</file>
+                  <type>sha256</type>
+                  
<checksum>61b825d68516541151e5ce0145e54765c48cd5802b886aee8fb8cf1953f02d10</checksum>
+                </requireFileChecksum>
+                <requireFileChecksum>
+                  <file>${project.basedir}/LICENSE</file>
+                  <type>sha384</type>
+                  
<checksum>6f9e6b81487911c5a339c541016a459acaf8312e430ccabe5c10cb2ddf9a307f4595c78555f911377f4fb853ffe87046</checksum>
+                </requireFileChecksum>
+                <requireFileChecksum>
+                  <file>${project.basedir}/LICENSE</file>
+                  <type>sha512</type>
+                  
<checksum>c51c3cf07c87af78dd7af4407ae3993ea1051d8a7c260cf34bbaa41c468dcd3b62d2be3d9a09807a8595d0065e2d75d1bf9ffc8276d567a983ff057f6b51b0cc</checksum>
+                </requireFileChecksum>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/require-file-checksum/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/require-file-checksum/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/enforcer/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/enforcer/trunk/pom.xml?rev=1771515&r1=1771514&r2=1771515&view=diff
==============================================================================
--- maven/enforcer/trunk/pom.xml (original)
+++ maven/enforcer/trunk/pom.xml Sat Nov 26 21:56:24 2016
@@ -142,6 +142,11 @@
         <version>2.3</version>
       </dependency>
       <dependency>
+        <groupId>commons-codec</groupId>
+        <artifactId>commons-codec</artifactId>
+        <version>1.6</version>
+      </dependency>
+      <dependency>
         <groupId>org.apache.maven.plugin-testing</groupId>
         <artifactId>maven-plugin-testing-harness</artifactId>
         <version>1.3</version>


Reply via email to