You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2017/12/30 14:44:55 UTC
[1/3] maven git commit: [MNG-6330] Parents relativePath not verified
anymore [Forced Update!]
Repository: maven
Updated Branches:
refs/heads/MNG-6305-validation-of-ci-friendly 14b86566e -> ec65d84d6 (forced update)
[MNG-6330] Parents relativePath not verified anymore
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/df5169bd
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/df5169bd
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/df5169bd
Branch: refs/heads/MNG-6305-validation-of-ci-friendly
Commit: df5169bdf9fead590d48e23fb182d7f73f1deb3d
Parents: 98af937
Author: rfscholte <rf...@apache.org>
Authored: Fri Dec 29 10:39:45 2017 +0100
Committer: rfscholte <rf...@apache.org>
Committed: Fri Dec 29 10:39:45 2017 +0100
----------------------------------------------------------------------
.../org/apache/maven/model/building/DefaultModelBuilder.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/df5169bd/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
index 463bf1c..c3dd043 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
@@ -845,8 +845,8 @@ public class DefaultModelBuilder
{
ModelSource expectedParentSource = getParentPomFile( childModel, childSource );
- if ( expectedParentSource instanceof ModelSource2
- && !pomFile.toURI().equals( ( (ModelSource2) expectedParentSource ).getLocationURI() ) )
+ if ( expectedParentSource == null || ( expectedParentSource instanceof ModelSource2
+ && !pomFile.toURI().equals( ( (ModelSource2) expectedParentSource ).getLocationURI() ) ) )
{
parentData = readParentExternally( childModel, request, problems );
}
[2/3] maven git commit: [MNG-6305] Validation of CI friendly version
incorrect o Checkin that only the three expression changelist,
revision and sha1 are valid in a version.
Posted by kh...@apache.org.
[MNG-6305] Validation of CI friendly version incorrect
o Checkin that only the three expression changelist,
revision and sha1 are valid in a version.
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/c2ece592
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/c2ece592
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/c2ece592
Branch: refs/heads/MNG-6305-validation-of-ci-friendly
Commit: c2ece5920242958a2baf377e1c5cae3784bbf01d
Parents: df5169b
Author: Karl Heinz Marbaise <kh...@apache.org>
Authored: Thu Dec 28 21:29:46 2017 +0100
Committer: Karl Heinz Marbaise <kh...@apache.org>
Committed: Sat Dec 30 15:44:42 2017 +0100
----------------------------------------------------------------------
.../AbstractStringBasedModelInterpolator.java | 6 +++
.../model/validation/DefaultModelValidator.java | 28 +++++++++---
.../validation/DefaultModelValidatorTest.java | 45 ++++++++++++++++++++
.../raw-model/bad-ci-friendly-sha1plus.xml | 31 ++++++++++++++
.../raw-model/bad-ci-friendly-sha1plus2.xml | 31 ++++++++++++++
.../validation/raw-model/bad-ci-friendly.xml | 31 ++++++++++++++
.../raw-model/ok-ci-friendly-changelist.xml | 31 ++++++++++++++
.../raw-model/ok-ci-friendly-revision.xml | 31 ++++++++++++++
.../raw-model/ok-ci-friendly-sha1.xml | 31 ++++++++++++++
9 files changed, 260 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/c2ece592/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
index b47edbe..09b53e4 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
@@ -61,6 +61,12 @@ public abstract class AbstractStringBasedModelInterpolator
public static final String CHANGELIST_PROPERTY = "changelist";
public static final String REVISION_PROPERTY = "revision";
+
+ public static final String SHA1_PROPERTY_EXPRESSION = "${" + SHA1_PROPERTY + "}";
+
+ public static final String CHANGELIST_PROPERTY_EXPRESSION = "${" + CHANGELIST_PROPERTY + "}";
+
+ public static final String REVISION_PROPERTY_EXPRESSION = "${" + REVISION_PROPERTY + "}";
private static final List<String> PROJECT_PREFIXES = Arrays.asList( "pom.", "project." );
http://git-wip-us.apache.org/repos/asf/maven/blob/c2ece592/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
index d97d8f6..51bf27e 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
@@ -532,7 +532,7 @@ public class DefaultModelValidator
ModelBuildingRequest request )
{
// We only check for groupId/artifactId cause if there is another
- // module with the same groupId/artifactId this will fail the build
+ // module with the same groupId/artifactId this will fail the build
// earlier like "Project '...' is duplicated in the reactor.
// So it is sufficient to check only groupId/artifactId and not the
// packaging type.
@@ -869,11 +869,29 @@ public class DefaultModelValidator
// sha1
//
string = string.trim();
- if ( string.contains( "${" + AbstractStringBasedModelInterpolator.CHANGELIST_PROPERTY + "}" )
- || string.contains( "${" + AbstractStringBasedModelInterpolator.REVISION_PROPERTY + "}" )
- || string.contains( "${" + AbstractStringBasedModelInterpolator.SHA1_PROPERTY + "}" ) )
+ if ( string.contains( AbstractStringBasedModelInterpolator.CHANGELIST_PROPERTY_EXPRESSION )
+ || string.contains( AbstractStringBasedModelInterpolator.REVISION_PROPERTY_EXPRESSION )
+ || string.contains( AbstractStringBasedModelInterpolator.SHA1_PROPERTY_EXPRESSION ) )
{
- return true;
+ //@formatter:off
+ String revision =
+ Pattern.compile( AbstractStringBasedModelInterpolator.REVISION_PROPERTY_EXPRESSION, Pattern.LITERAL )
+ .matcher( string )
+ .replaceAll( AbstractStringBasedModelInterpolator.REVISION_PROPERTY );
+ revision =
+ Pattern.compile( AbstractStringBasedModelInterpolator.CHANGELIST_PROPERTY_EXPRESSION, Pattern.LITERAL )
+ .matcher( revision )
+ .replaceAll( AbstractStringBasedModelInterpolator.CHANGELIST_PROPERTY );
+ revision =
+ Pattern.compile( AbstractStringBasedModelInterpolator.SHA1_PROPERTY_EXPRESSION, Pattern.LITERAL )
+ .matcher( revision )
+ .replaceAll( AbstractStringBasedModelInterpolator.SHA1_PROPERTY );
+ //@formatter:on
+
+ if ( !hasExpression( revision ) )
+ {
+ return true;
+ }
}
addViolation( problems, severity, version, fieldName, null, "contains an expression but should be a constant.",
http://git-wip-us.apache.org/repos/asf/maven/blob/c2ece592/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
index 5614daf..687f99c 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
@@ -727,4 +727,49 @@ public class DefaultModelValidatorTest
}
+ public void testCiFriendlySha1()
+ throws Exception
+ {
+ SimpleProblemCollector result = validateRaw( "raw-model/ok-ci-friendly-sha1.xml" );
+ assertViolations( result, 0, 0, 0 );
+ }
+
+ public void testCiFriendlyRevision()
+ throws Exception
+ {
+ SimpleProblemCollector result = validateRaw( "raw-model/ok-ci-friendly-revision.xml" );
+ assertViolations( result, 0, 0, 0 );
+ }
+
+ public void testCiFriendlyChangeList()
+ throws Exception
+ {
+ SimpleProblemCollector result = validateRaw( "raw-model/ok-ci-friendly-changelist.xml" );
+ assertViolations( result, 0, 0, 0 );
+ }
+
+ public void testCiFriendlyBad()
+ throws Exception
+ {
+ SimpleProblemCollector result = validateRaw( "raw-model/bad-ci-friendly.xml" );
+ assertViolations( result, 0, 0, 1 );
+ assertEquals( "'version' contains an expression but should be a constant.", result.getWarnings().get( 0 ) );
+ }
+
+ public void testCiFriendlyBadSha1Plus()
+ throws Exception
+ {
+ SimpleProblemCollector result = validateRaw( "raw-model/bad-ci-friendly-sha1plus.xml" );
+ assertViolations( result, 0, 0, 1 );
+ assertEquals( "'version' contains an expression but should be a constant.", result.getWarnings().get( 0 ) );
+ }
+
+ public void testCiFriendlyBadSha1Plus2()
+ throws Exception
+ {
+ SimpleProblemCollector result = validateRaw( "raw-model/bad-ci-friendly-sha1plus2.xml" );
+ assertViolations( result, 0, 0, 1 );
+ assertEquals( "'version' contains an expression but should be a constant.", result.getWarnings().get( 0 ) );
+ }
+
}
http://git-wip-us.apache.org/repos/asf/maven/blob/c2ece592/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-ci-friendly-sha1plus.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-ci-friendly-sha1plus.xml b/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-ci-friendly-sha1plus.xml
new file mode 100644
index 0000000..35642d8
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-ci-friendly-sha1plus.xml
@@ -0,0 +1,31 @@
+<!--
+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>com.example.group</groupId>
+ <artifactId>valid-version-sha1plus</artifactId>
+ <version>${sha1}${wrong}</version>
+
+ <description>
+ This will test if the validation for the ci friendly versions
+ is working correct.
+ </description>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/c2ece592/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-ci-friendly-sha1plus2.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-ci-friendly-sha1plus2.xml b/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-ci-friendly-sha1plus2.xml
new file mode 100644
index 0000000..7f9ab2c
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-ci-friendly-sha1plus2.xml
@@ -0,0 +1,31 @@
+<!--
+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>com.example.group</groupId>
+ <artifactId>valid-version-sha1plus</artifactId>
+ <version>${sha1}${wrong}${revision}</version>
+
+ <description>
+ This will test if the validation for the ci friendly versions
+ is working correct.
+ </description>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/c2ece592/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-ci-friendly.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-ci-friendly.xml b/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-ci-friendly.xml
new file mode 100644
index 0000000..9288b35
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/validation/raw-model/bad-ci-friendly.xml
@@ -0,0 +1,31 @@
+<!--
+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>com.example.group</groupId>
+ <artifactId>valid-version-wrong</artifactId>
+ <version>${wrong}</version>
+
+ <description>
+ This will test if the validation for the ci friendly versions
+ is working correct.
+ </description>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/c2ece592/maven-model-builder/src/test/resources/poms/validation/raw-model/ok-ci-friendly-changelist.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/validation/raw-model/ok-ci-friendly-changelist.xml b/maven-model-builder/src/test/resources/poms/validation/raw-model/ok-ci-friendly-changelist.xml
new file mode 100644
index 0000000..f4a1da7
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/validation/raw-model/ok-ci-friendly-changelist.xml
@@ -0,0 +1,31 @@
+<!--
+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>com.example.group</groupId>
+ <artifactId>valid-version-changelist</artifactId>
+ <version>${changelist}</version>
+
+ <description>
+ This will test if the validation for the ci friendly versions
+ is working correct.
+ </description>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/c2ece592/maven-model-builder/src/test/resources/poms/validation/raw-model/ok-ci-friendly-revision.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/validation/raw-model/ok-ci-friendly-revision.xml b/maven-model-builder/src/test/resources/poms/validation/raw-model/ok-ci-friendly-revision.xml
new file mode 100644
index 0000000..565cd7b
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/validation/raw-model/ok-ci-friendly-revision.xml
@@ -0,0 +1,31 @@
+<!--
+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>com.example.group</groupId>
+ <artifactId>valid-version-revision</artifactId>
+ <version>${revision}</version>
+
+ <description>
+ This will test if the validation for the ci friendly versions
+ is working correct.
+ </description>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven/blob/c2ece592/maven-model-builder/src/test/resources/poms/validation/raw-model/ok-ci-friendly-sha1.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/validation/raw-model/ok-ci-friendly-sha1.xml b/maven-model-builder/src/test/resources/poms/validation/raw-model/ok-ci-friendly-sha1.xml
new file mode 100644
index 0000000..5287c99
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/validation/raw-model/ok-ci-friendly-sha1.xml
@@ -0,0 +1,31 @@
+<!--
+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>com.example.group</groupId>
+ <artifactId>valid-version-sha1</artifactId>
+ <version>${sha1}</version>
+
+ <description>
+ This will test if the validation for the ci friendly versions
+ is working correct. This c
+ </description>
+</project>
\ No newline at end of file
[3/3] maven git commit: Refactored a little bit.
Posted by kh...@apache.org.
Refactored a little bit.
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/ec65d84d
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/ec65d84d
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/ec65d84d
Branch: refs/heads/MNG-6305-validation-of-ci-friendly
Commit: ec65d84d6aff884cc0e3c87d64fac266f3e424fb
Parents: c2ece59
Author: Karl Heinz Marbaise <kh...@apache.org>
Authored: Sat Dec 30 15:14:15 2017 +0100
Committer: Karl Heinz Marbaise <kh...@apache.org>
Committed: Sat Dec 30 15:44:42 2017 +0100
----------------------------------------------------------------------
.../model/validation/DefaultModelValidator.java | 27 +++++++++++++-------
1 file changed, 18 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/ec65d84d/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
index 51bf27e..30c0043 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
@@ -65,6 +65,15 @@ public class DefaultModelValidator
implements ModelValidator
{
+ private static final Pattern PATTERN_SHA1_PROPERTY =
+ Pattern.compile( AbstractStringBasedModelInterpolator.SHA1_PROPERTY_EXPRESSION, Pattern.LITERAL );
+
+ private static final Pattern PATTERN_CHANGELIST_PROPERTY =
+ Pattern.compile( AbstractStringBasedModelInterpolator.CHANGELIST_PROPERTY_EXPRESSION, Pattern.LITERAL );
+
+ private static final Pattern PATTERN_REVISION_PROPERTY =
+ Pattern.compile( AbstractStringBasedModelInterpolator.REVISION_PROPERTY_EXPRESSION, Pattern.LITERAL );
+
private static final Pattern ID_REGEX = Pattern.compile( "[A-Za-z0-9_\\-.]+" );
private static final Pattern ID_WITH_WILDCARDS_REGEX = Pattern.compile( "[A-Za-z0-9_\\-.?*]+" );
@@ -874,21 +883,21 @@ public class DefaultModelValidator
|| string.contains( AbstractStringBasedModelInterpolator.SHA1_PROPERTY_EXPRESSION ) )
{
//@formatter:off
- String revision =
- Pattern.compile( AbstractStringBasedModelInterpolator.REVISION_PROPERTY_EXPRESSION, Pattern.LITERAL )
+ string =
+ PATTERN_REVISION_PROPERTY
.matcher( string )
.replaceAll( AbstractStringBasedModelInterpolator.REVISION_PROPERTY );
- revision =
- Pattern.compile( AbstractStringBasedModelInterpolator.CHANGELIST_PROPERTY_EXPRESSION, Pattern.LITERAL )
- .matcher( revision )
+ string =
+ PATTERN_CHANGELIST_PROPERTY
+ .matcher( string )
.replaceAll( AbstractStringBasedModelInterpolator.CHANGELIST_PROPERTY );
- revision =
- Pattern.compile( AbstractStringBasedModelInterpolator.SHA1_PROPERTY_EXPRESSION, Pattern.LITERAL )
- .matcher( revision )
+ string =
+ PATTERN_SHA1_PROPERTY
+ .matcher( string )
.replaceAll( AbstractStringBasedModelInterpolator.SHA1_PROPERTY );
//@formatter:on
- if ( !hasExpression( revision ) )
+ if ( !hasExpression( string ) )
{
return true;
}