You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2018/01/06 21:14:49 UTC
[1/9] maven git commit: Ensure any forked Maven executions are not
spied on by Jenkins [Forced Update!]
Repository: maven
Updated Branches:
refs/heads/MNG-6308_display_packaging 8882a18a6 -> b1eee46e3 (forced update)
Ensure any forked Maven executions are not spied on by Jenkins
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/a670c2ea
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/a670c2ea
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/a670c2ea
Branch: refs/heads/MNG-6308_display_packaging
Commit: a670c2ea1f592563b756b31d650c9a6db553fbdb
Parents: 5411c5a
Author: Stephen Connolly <st...@gmail.com>
Authored: Tue Dec 12 15:29:35 2017 +0000
Committer: Stephen Connolly <st...@gmail.com>
Committed: Tue Dec 12 15:29:35 2017 +0000
----------------------------------------------------------------------
pom.xml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/a670c2ea/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a572e4b..c784d9d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -462,6 +462,7 @@ under the License.
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xmx256m</argLine>
+ <environmentVariables>JENKINS_MAVEN_AGENT_DISABLED=true</environmentVariables>
</configuration>
</plugin>
<plugin>
[6/9] maven git commit: [MNG-6305] Validation of CI friendly version
incorrect o Followup removed unused declarations.
Posted by hb...@apache.org.
[MNG-6305] Validation of CI friendly version incorrect
o Followup removed unused declarations.
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/6b83f7e6
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/6b83f7e6
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/6b83f7e6
Branch: refs/heads/MNG-6308_display_packaging
Commit: 6b83f7e6bb38cf49c43251c0d84bcae61800fd1a
Parents: 2295c17
Author: Karl Heinz Marbaise <kh...@apache.org>
Authored: Sat Dec 30 22:09:02 2017 +0100
Committer: Karl Heinz Marbaise <kh...@apache.org>
Committed: Sat Dec 30 22:09:02 2017 +0100
----------------------------------------------------------------------
.../interpolation/AbstractStringBasedModelInterpolator.java | 6 ------
1 file changed, 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/6b83f7e6/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 09b53e4..ae8a35e 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
@@ -62,12 +62,6 @@ public abstract class AbstractStringBasedModelInterpolator
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." );
private static final Collection<String> TRANSLATED_PATH_EXPRESSIONS;
[2/9] maven git commit: Ensure any forked Maven executions are not
spied on by Jenkins
Posted by hb...@apache.org.
Ensure any forked Maven executions are not spied on by Jenkins
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/eee06f7d
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/eee06f7d
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/eee06f7d
Branch: refs/heads/MNG-6308_display_packaging
Commit: eee06f7d7c736cbc1668dc7eae5dc21fd4b1075f
Parents: a670c2e
Author: Stephen Connolly <st...@gmail.com>
Authored: Wed Dec 13 00:45:00 2017 +0000
Committer: Stephen Connolly <st...@gmail.com>
Committed: Wed Dec 13 00:45:00 2017 +0000
----------------------------------------------------------------------
pom.xml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/eee06f7d/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index c784d9d..8f31bf1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -462,7 +462,9 @@ under the License.
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xmx256m</argLine>
- <environmentVariables>JENKINS_MAVEN_AGENT_DISABLED=true</environmentVariables>
+ <environmentVariables>
+ <JENKINS_MAVEN_AGENT_DISABLED>true</JENKINS_MAVEN_AGENT_DISABLED>
+ </environmentVariables>
</configuration>
</plugin>
<plugin>
[7/9] maven git commit: [MNG-6308] added unit test for "Building"
message
Posted by hb...@apache.org.
[MNG-6308] added unit test for "Building" message
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/4d712e7b
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/4d712e7b
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/4d712e7b
Branch: refs/heads/MNG-6308_display_packaging
Commit: 4d712e7bfc963667a1680d6d0cf0f022638fb856
Parents: 6b83f7e
Author: Hervé Boutemy <hb...@apache.org>
Authored: Sat Jan 6 22:07:17 2018 +0100
Committer: Hervé Boutemy <hb...@apache.org>
Committed: Sat Jan 6 22:07:17 2018 +0100
----------------------------------------------------------------------
maven-embedder/pom.xml | 4 +
.../cli/event/ExecutionEventLoggerTest.java | 78 ++++++++++++++++++++
2 files changed, 82 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/4d712e7b/maven-embedder/pom.xml
----------------------------------------------------------------------
diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml
index d6576f9..cfc126f 100644
--- a/maven-embedder/pom.xml
+++ b/maven-embedder/pom.xml
@@ -139,6 +139,10 @@ under the License.
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<scope>test</scope>
http://git-wip-us.apache.org/repos/asf/maven/blob/4d712e7b/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
new file mode 100644
index 0000000..515f9fe
--- /dev/null
+++ b/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
@@ -0,0 +1,78 @@
+package org.apache.maven.cli.event;
+
+/*
+ * 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 static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.maven.execution.ExecutionEvent;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.utils.logging.MessageUtils;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.InOrder;
+import org.slf4j.Logger;
+
+public class ExecutionEventLoggerTest
+{
+ private ExecutionEventLogger executionEventLogger;
+
+ @BeforeClass
+ public static void setUp()
+ {
+ MessageUtils.setColorEnabled( false );
+ }
+
+ @AfterClass
+ public static void tearDown()
+ {
+ MessageUtils.setColorEnabled( true );
+ }
+
+ @Test
+ public void testProjectStarted()
+ {
+ // prepare
+ Logger logger = mock( Logger.class );
+ when( logger.isInfoEnabled() ).thenReturn( true );
+ executionEventLogger = new ExecutionEventLogger( logger );
+
+ ExecutionEvent event = mock( ExecutionEvent.class );
+ MavenProject project = mock( MavenProject.class );
+ when( project.getGroupId() ).thenReturn( "org.apache.maven" );
+ when( project.getArtifactId() ).thenReturn( "maven-embedder" );
+ when( project.getPackaging() ).thenReturn( "jar" );
+ when( project.getName() ).thenReturn( "Apache Maven Embedder" );
+ when( project.getVersion() ).thenReturn( "3.5.4-SNAPSHOT" );
+ when( event.getProject() ).thenReturn( project );
+
+ // execute
+ executionEventLogger.projectStarted( event );
+
+ // verify
+ InOrder inOrder = inOrder( logger );
+ inOrder.verify( logger ).info( "" );
+ inOrder.verify( logger ).info( "------------------------------------------------------------------------" );
+ inOrder.verify( logger ).info( "Building Apache Maven Embedder 3.5.4-SNAPSHOT" );
+ inOrder.verify( logger ).info( "------------------------------------------------------------------------" );
+ }
+}
[9/9] maven git commit: [MNG-6308] added packaging in Building
message footer and summary
Posted by hb...@apache.org.
[MNG-6308] added packaging in Building message footer and summary
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/b1eee46e
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/b1eee46e
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/b1eee46e
Branch: refs/heads/MNG-6308_display_packaging
Commit: b1eee46e39a7b137928de2184bc5dab3776d0772
Parents: 47c3ecb
Author: Hervé Boutemy <hb...@apache.org>
Authored: Sat Jan 6 22:14:00 2018 +0100
Committer: Hervé Boutemy <hb...@apache.org>
Committed: Sat Jan 6 22:14:00 2018 +0100
----------------------------------------------------------------------
.../org/apache/maven/cli/event/ExecutionEventLogger.java | 9 +++++++--
.../apache/maven/cli/event/ExecutionEventLoggerTest.java | 4 ++--
2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/b1eee46e/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
index 3da9ad3..85760e6 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
@@ -114,7 +114,9 @@ public class ExecutionEventLogger
final List<MavenProject> projects = event.getSession().getProjects();
for ( MavenProject project : projects )
{
- logger.info( project.getName() );
+ int len = LINE_LENGTH - project.getName().length() - project.getPackaging().length() - 2;
+ logger.info( project.getName() + chars( ' ', ( len > 0 ) ? len : 1 ) + '[' + project.getPackaging()
+ + ']' );
}
totalProjects = projects.size();
@@ -302,7 +304,10 @@ public class ExecutionEventLogger
infoMain( building + ( ( pad > 0 ) ? chars( ' ', pad ) : "" ) + progress );
}
- infoLine( '-' );
+ // ----------[ packaging ]----------
+ prefix = chars( '-', Math.max( 0, ( LINE_LENGTH - project.getPackaging().length() - 4 ) / 2 ) );
+ suffix = chars( '-', Math.max( 0, LINE_LENGTH - project.getPackaging().length() - 4 - prefix.length() ) );
+ infoMain( prefix + "[ " + project.getPackaging() + " ]" + suffix );
}
}
http://git-wip-us.apache.org/repos/asf/maven/blob/b1eee46e/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
index 4c0539d..ca4c8a4 100644
--- a/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
+++ b/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
@@ -73,7 +73,7 @@ public class ExecutionEventLoggerTest
inOrder.verify( logger ).info( "" );
inOrder.verify( logger ).info( "------------------< org.apache.maven:maven-embedder >-------------------" );
inOrder.verify( logger ).info( "Building Apache Maven Embedder 3.5.4-SNAPSHOT" );
- inOrder.verify( logger ).info( "------------------------------------------------------------------------" );
+ inOrder.verify( logger ).info( "--------------------------------[ jar ]---------------------------------" );
}
@Test
@@ -101,6 +101,6 @@ public class ExecutionEventLoggerTest
inOrder.verify( logger ).info( "" );
inOrder.verify( logger ).info( "--< org.apache.maven.plugins.overflow:maven-project-info-reports-plugin >--" );
inOrder.verify( logger ).info( "Building Apache Maven Project Info Reports Plugin 3.0.0-SNAPSHOT" );
- inOrder.verify( logger ).info( "------------------------------------------------------------------------" );
+ inOrder.verify( logger ).info( "----------------------------[ maven-plugin ]----------------------------" );
}
}
[4/9] maven git commit: [MNG-6330] Parents relativePath not verified
anymore
Posted by hb...@apache.org.
[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-6308_display_packaging
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 );
}
[8/9] maven git commit: [MNG-6308] display groupId:artifactId in
Building message header
Posted by hb...@apache.org.
[MNG-6308] display groupId:artifactId in Building message header
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/47c3ecb9
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/47c3ecb9
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/47c3ecb9
Branch: refs/heads/MNG-6308_display_packaging
Commit: 47c3ecb90517f45c800b61941d0a8803679548cd
Parents: 4d712e7
Author: Hervé Boutemy <hb...@apache.org>
Authored: Sat Jan 6 22:12:08 2018 +0100
Committer: Hervé Boutemy <hb...@apache.org>
Committed: Sat Jan 6 22:12:08 2018 +0100
----------------------------------------------------------------------
.../maven/cli/event/ExecutionEventLogger.java | 21 ++++++++++++--
.../cli/event/ExecutionEventLoggerTest.java | 30 +++++++++++++++++++-
2 files changed, 48 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/47c3ecb9/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
index 513d56a..3da9ad3 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
@@ -261,9 +261,26 @@ public class ExecutionEventLogger
{
if ( logger.isInfoEnabled() )
{
+ MavenProject project = event.getProject();
+
logger.info( "" );
- infoLine( '-' );
+ // -------< groupId:artifactId >-------
+ String projectKey = project.getGroupId() + ':' + project.getArtifactId();
+
+ final String preHeader = "--< ";
+ final String postHeader = " >--";
+
+ final int headerLen = preHeader.length() + projectKey.length() + postHeader.length();
+
+ String prefix = chars( '-', Math.max( 0, ( LINE_LENGTH - headerLen ) / 2 ) ) + preHeader;
+
+ String suffix = postHeader
+ + chars( '-', Math.max( 0, LINE_LENGTH - headerLen - prefix.length() + preHeader.length() ) );
+
+ logger.info( buffer().strong( prefix ).project( projectKey ).strong( suffix ).toString() );
+
+ // Building Project Name Version [i/n]
String building = "Building " + event.getProject().getName() + " " + event.getProject().getVersion();
if ( totalProjects <= 1 )
@@ -283,7 +300,7 @@ public class ExecutionEventLogger
int pad = LINE_LENGTH - building.length() - progress.length();
infoMain( building + ( ( pad > 0 ) ? chars( ' ', pad ) : "" ) + progress );
- } // else what's the point
+ }
infoLine( '-' );
}
http://git-wip-us.apache.org/repos/asf/maven/blob/47c3ecb9/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
index 515f9fe..4c0539d 100644
--- a/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
+++ b/maven-embedder/src/test/java/org/apache/maven/cli/event/ExecutionEventLoggerTest.java
@@ -71,8 +71,36 @@ public class ExecutionEventLoggerTest
// verify
InOrder inOrder = inOrder( logger );
inOrder.verify( logger ).info( "" );
- inOrder.verify( logger ).info( "------------------------------------------------------------------------" );
+ inOrder.verify( logger ).info( "------------------< org.apache.maven:maven-embedder >-------------------" );
inOrder.verify( logger ).info( "Building Apache Maven Embedder 3.5.4-SNAPSHOT" );
inOrder.verify( logger ).info( "------------------------------------------------------------------------" );
}
+
+ @Test
+ public void testProjectStartedOverflow()
+ {
+ // prepare
+ Logger logger = mock( Logger.class );
+ when( logger.isInfoEnabled() ).thenReturn( true );
+ executionEventLogger = new ExecutionEventLogger( logger );
+
+ ExecutionEvent event = mock( ExecutionEvent.class );
+ MavenProject project = mock( MavenProject.class );
+ when( project.getGroupId() ).thenReturn( "org.apache.maven.plugins.overflow" );
+ when( project.getArtifactId() ).thenReturn( "maven-project-info-reports-plugin" );
+ when( project.getPackaging() ).thenReturn( "maven-plugin" );
+ when( project.getName() ).thenReturn( "Apache Maven Project Info Reports Plugin" );
+ when( project.getVersion() ).thenReturn( "3.0.0-SNAPSHOT" );
+ when( event.getProject() ).thenReturn( project );
+
+ // execute
+ executionEventLogger.projectStarted( event );
+
+ // verify
+ InOrder inOrder = inOrder( logger );
+ inOrder.verify( logger ).info( "" );
+ inOrder.verify( logger ).info( "--< org.apache.maven.plugins.overflow:maven-project-info-reports-plugin >--" );
+ inOrder.verify( logger ).info( "Building Apache Maven Project Info Reports Plugin 3.0.0-SNAPSHOT" );
+ inOrder.verify( logger ).info( "------------------------------------------------------------------------" );
+ }
}
[3/9] maven git commit: [MNG-6300] Multi module release creates empty
directories in war file instead of jars
Posted by hb...@apache.org.
[MNG-6300] Multi module release creates empty directories in war file instead of jars
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/98af937b
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/98af937b
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/98af937b
Branch: refs/heads/MNG-6308_display_packaging
Commit: 98af937bc6298e82e489b5f0cd3fb0a1c3d37109
Parents: eee06f7
Author: rfscholte <rf...@apache.org>
Authored: Fri Dec 22 14:25:46 2017 +0100
Committer: rfscholte <rf...@apache.org>
Committed: Fri Dec 22 14:25:46 2017 +0100
----------------------------------------------------------------------
.../java/org/apache/maven/RepositoryUtils.java | 69 +++++
.../internal/LifecycleDependencyResolver.java | 36 ++-
.../org/apache/maven/plugin/CacheUtils.java | 68 -----
.../plugin/DefaultPluginArtifactsCache.java | 32 +--
.../plugin/DefaultPluginDescriptorCache.java | 7 +-
.../maven/plugin/DefaultPluginRealmCache.java | 36 ++-
.../plugin/DefaultProjectArtifactsCache.java | 256 -------------------
.../maven/plugin/ProjectArtifactsCache.java | 90 -------
.../artifact/DefaultProjectArtifactsCache.java | 246 ++++++++++++++++++
.../project/artifact/ProjectArtifactsCache.java | 90 +++++++
.../AbstractCoreMavenComponentTestCase.java | 30 ++-
.../LifecycleDependencyResolverTest.java | 90 +++++++
.../lifecycle-dependency-resolver/lib/pom.xml | 32 +++
.../lifecycle-dependency-resolver/pom.xml | 58 +++++
.../lifecycle-dependency-resolver/war/pom.xml | 53 ++++
15 files changed, 723 insertions(+), 470 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/98af937b/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java b/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java
index 52442b7..00f1327 100644
--- a/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java
+++ b/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java
@@ -22,14 +22,17 @@ package org.apache.maven;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.ArtifactProperties;
import org.eclipse.aether.artifact.ArtifactType;
@@ -44,6 +47,8 @@ import org.eclipse.aether.repository.Authentication;
import org.eclipse.aether.repository.Proxy;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.repository.RepositoryPolicy;
+import org.eclipse.aether.repository.WorkspaceReader;
+import org.eclipse.aether.repository.WorkspaceRepository;
import org.eclipse.aether.util.repository.AuthenticationBuilder;
/**
@@ -364,4 +369,68 @@ public class RepositoryUtils
}
return artifacts;
}
+
+ public static WorkspaceRepository getWorkspace( RepositorySystemSession session )
+ {
+ WorkspaceReader reader = session.getWorkspaceReader();
+ return ( reader != null ) ? reader.getRepository() : null;
+ }
+
+ public static boolean repositoriesEquals( List<RemoteRepository> r1, List<RemoteRepository> r2 )
+ {
+ if ( r1.size() != r2.size() )
+ {
+ return false;
+ }
+
+ for ( Iterator<RemoteRepository> it1 = r1.iterator(), it2 = r2.iterator(); it1.hasNext(); )
+ {
+ if ( !repositoryEquals( it1.next(), it2.next() ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static int repositoriesHashCode( List<RemoteRepository> repositories )
+ {
+ int result = 17;
+ for ( RemoteRepository repository : repositories )
+ {
+ result = 31 * result + repositoryHashCode( repository );
+ }
+ return result;
+ }
+
+ private static int repositoryHashCode( RemoteRepository repository )
+ {
+ int result = 17;
+ Object obj = repository.getUrl();
+ result = 31 * result + ( obj != null ? obj.hashCode() : 0 );
+ return result;
+ }
+
+ private static boolean policyEquals( RepositoryPolicy p1, RepositoryPolicy p2 )
+ {
+ if ( p1 == p2 )
+ {
+ return true;
+ }
+ // update policy doesn't affect contents
+ return p1.isEnabled() == p2.isEnabled() && Objects.equals( p1.getChecksumPolicy(), p2.getChecksumPolicy() );
+ }
+
+ private static boolean repositoryEquals( RemoteRepository r1, RemoteRepository r2 )
+ {
+ if ( r1 == r2 )
+ {
+ return true;
+ }
+
+ return Objects.equals( r1.getId(), r2.getId() ) && Objects.equals( r1.getUrl(), r2.getUrl() )
+ && policyEquals( r1.getPolicy( false ), r2.getPolicy( false ) )
+ && policyEquals( r1.getPolicy( true ), r2.getPolicy( true ) );
+ }
}
http://git-wip-us.apache.org/repos/asf/maven/blob/98af937b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java
index 504274f..f7636ef 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java
@@ -19,6 +19,8 @@ package org.apache.maven.lifecycle.internal;
* under the License.
*/
+import java.io.File;
+
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -37,13 +39,13 @@ import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.eventspy.internal.EventSpyDispatcher;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.lifecycle.LifecycleExecutionException;
-import org.apache.maven.plugin.ProjectArtifactsCache;
import org.apache.maven.project.DefaultDependencyResolutionRequest;
import org.apache.maven.project.DependencyResolutionException;
import org.apache.maven.project.DependencyResolutionResult;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectDependenciesResolver;
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
+import org.apache.maven.project.artifact.ProjectArtifactsCache;
import org.codehaus.plexus.logging.Logger;
import org.eclipse.aether.graph.Dependency;
import org.eclipse.aether.graph.DependencyFilter;
@@ -128,7 +130,7 @@ public class LifecycleDependencyResolver
}
}
- Set<Artifact> artifacts;
+ Set<Artifact> resolvedArtifacts;
ProjectArtifactsCache.Key cacheKey = projectArtifactsCache.createKey( project, scopesToCollect,
scopesToResolve, aggregating, session.getRepositorySession() );
ProjectArtifactsCache.CacheRecord recordArtifacts;
@@ -136,15 +138,15 @@ public class LifecycleDependencyResolver
if ( recordArtifacts != null )
{
- artifacts = recordArtifacts.artifacts;
+ resolvedArtifacts = recordArtifacts.artifacts;
}
else
{
try
{
- artifacts = getDependencies( project, scopesToCollect, scopesToResolve, session, aggregating,
- projectArtifacts );
- recordArtifacts = projectArtifactsCache.put( cacheKey, artifacts );
+ resolvedArtifacts = getDependencies( project, scopesToCollect, scopesToResolve, session,
+ aggregating, projectArtifacts );
+ recordArtifacts = projectArtifactsCache.put( cacheKey, resolvedArtifacts );
}
catch ( LifecycleExecutionException e )
{
@@ -155,13 +157,31 @@ public class LifecycleDependencyResolver
}
projectArtifactsCache.register( project, cacheKey, recordArtifacts );
- project.setResolvedArtifacts( artifacts );
+ Map<Artifact, File> reactorProjects = new HashMap<>( session.getProjects().size() );
+ for ( MavenProject reactorProject : session.getProjects() )
+ {
+ reactorProjects.put( reactorProject.getArtifact(), reactorProject.getArtifact().getFile() );
+ }
Map<String, Artifact> map = new HashMap<>();
- for ( Artifact artifact : artifacts )
+ for ( Artifact artifact : resolvedArtifacts )
{
+ /**
+ * MNG-6300: resolvedArtifacts can be cache result; this ensures reactor files are always up to date
+ * During lifecycle the Artifact.getFile() can change from target/classes to the actual jar.
+ * This clearly shows that target/classes should not be abused as artifactFile just for the classpath
+ */
+ File reactorProjectFile = reactorProjects.get( artifact );
+ if ( reactorProjectFile != null )
+ {
+ artifact.setFile( reactorProjectFile );
+ }
+
map.put( artifact.getDependencyConflictId(), artifact );
}
+
+ project.setResolvedArtifacts( resolvedArtifacts );
+
for ( Artifact artifact : project.getDependencyArtifacts() )
{
if ( artifact.getFile() == null )
http://git-wip-us.apache.org/repos/asf/maven/blob/98af937b/maven-core/src/main/java/org/apache/maven/plugin/CacheUtils.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/CacheUtils.java b/maven-core/src/main/java/org/apache/maven/plugin/CacheUtils.java
index a73e1ef..7196ce9 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/CacheUtils.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/CacheUtils.java
@@ -25,11 +25,6 @@ import java.util.List;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Exclusion;
import org.apache.maven.model.Plugin;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.repository.RepositoryPolicy;
-import org.eclipse.aether.repository.WorkspaceReader;
-import org.eclipse.aether.repository.WorkspaceRepository;
/**
* @author Benjamin Bentmann
@@ -47,63 +42,6 @@ class CacheUtils
return obj != null ? obj.hashCode() : 0;
}
- public static int repositoriesHashCode( List<RemoteRepository> repositories )
- {
- int result = 17;
- for ( RemoteRepository repository : repositories )
- {
- result = 31 * result + repositoryHashCode( repository );
- }
- return result;
- }
-
- private static int repositoryHashCode( RemoteRepository repository )
- {
- int result = 17;
- result = 31 * result + hash( repository.getUrl() );
- return result;
- }
-
- private static boolean repositoryEquals( RemoteRepository r1, RemoteRepository r2 )
- {
- if ( r1 == r2 )
- {
- return true;
- }
-
- return eq( r1.getId(), r2.getId() ) && eq( r1.getUrl(), r2.getUrl() )
- && policyEquals( r1.getPolicy( false ), r2.getPolicy( false ) )
- && policyEquals( r1.getPolicy( true ), r2.getPolicy( true ) );
- }
-
- private static boolean policyEquals( RepositoryPolicy p1, RepositoryPolicy p2 )
- {
- if ( p1 == p2 )
- {
- return true;
- }
- // update policy doesn't affect contents
- return p1.isEnabled() == p2.isEnabled() && eq( p1.getChecksumPolicy(), p2.getChecksumPolicy() );
- }
-
- public static boolean repositoriesEquals( List<RemoteRepository> r1, List<RemoteRepository> r2 )
- {
- if ( r1.size() != r2.size() )
- {
- return false;
- }
-
- for ( Iterator<RemoteRepository> it1 = r1.iterator(), it2 = r2.iterator(); it1.hasNext(); )
- {
- if ( !repositoryEquals( it1.next(), it2.next() ) )
- {
- return false;
- }
- }
-
- return true;
- }
-
public static int pluginHashCode( Plugin plugin )
{
int hash = 17;
@@ -202,10 +140,4 @@ class CacheUtils
return true;
}
- public static WorkspaceRepository getWorkspace( RepositorySystemSession session )
- {
- WorkspaceReader reader = session.getWorkspaceReader();
- return ( reader != null ) ? reader.getRepository() : null;
- }
-
}
http://git-wip-us.apache.org/repos/asf/maven/blob/98af937b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginArtifactsCache.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginArtifactsCache.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginArtifactsCache.java
index 6a08681..b49e25e 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginArtifactsCache.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginArtifactsCache.java
@@ -23,9 +23,11 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.lang3.Validate;
+import org.apache.maven.RepositoryUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Plugin;
import org.apache.maven.project.MavenProject;
@@ -48,7 +50,6 @@ public class DefaultPluginArtifactsCache
protected static class CacheKey
implements Key
{
-
private final Plugin plugin;
private final WorkspaceRepository workspace;
@@ -65,7 +66,7 @@ public class DefaultPluginArtifactsCache
RepositorySystemSession session )
{
this.plugin = plugin.clone();
- workspace = CacheUtils.getWorkspace( session );
+ workspace = RepositoryUtils.getWorkspace( session );
this.localRepo = session.getLocalRepository();
this.repositories = new ArrayList<>( repositories.size() );
for ( RemoteRepository repository : repositories )
@@ -83,10 +84,10 @@ public class DefaultPluginArtifactsCache
int hash = 17;
hash = hash * 31 + CacheUtils.pluginHashCode( plugin );
- hash = hash * 31 + hash( workspace );
- hash = hash * 31 + hash( localRepo );
- hash = hash * 31 + CacheUtils.repositoriesHashCode( repositories );
- hash = hash * 31 + hash( extensionFilter );
+ hash = hash * 31 + Objects.hashCode( workspace );
+ hash = hash * 31 + Objects.hashCode( localRepo );
+ hash = hash * 31 + RepositoryUtils.repositoriesHashCode( repositories );
+ hash = hash * 31 + Objects.hashCode( extensionFilter );
this.hashCode = hash;
}
@@ -102,11 +103,6 @@ public class DefaultPluginArtifactsCache
return hashCode;
}
- private static int hash( Object obj )
- {
- return obj != null ? obj.hashCode() : 0;
- }
-
@Override
public boolean equals( Object o )
{
@@ -122,16 +118,12 @@ public class DefaultPluginArtifactsCache
CacheKey that = (CacheKey) o;
- return CacheUtils.pluginEquals( plugin, that.plugin ) && eq( workspace, that.workspace )
- && eq( localRepo, that.localRepo ) && CacheUtils.repositoriesEquals( repositories, that.repositories )
- && eq( filter, that.filter );
+ return CacheUtils.pluginEquals( plugin, that.plugin )
+ && Objects.equals( workspace, that.workspace )
+ && Objects.equals( localRepo, that.localRepo )
+ && RepositoryUtils.repositoriesEquals( repositories, that.repositories )
+ && Objects.equals( filter, that.filter );
}
-
- private static <T> boolean eq( T s1, T s2 )
- {
- return s1 != null ? s1.equals( s2 ) : s2 == null;
- }
-
}
protected final Map<Key, CacheRecord> cache = new ConcurrentHashMap<>();
http://git-wip-us.apache.org/repos/asf/maven/blob/98af937b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginDescriptorCache.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginDescriptorCache.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginDescriptorCache.java
index 5968332..32228ba 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginDescriptorCache.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginDescriptorCache.java
@@ -24,6 +24,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.maven.RepositoryUtils;
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
@@ -146,7 +147,7 @@ public class DefaultPluginDescriptorCache
artifactId = plugin.getArtifactId();
version = plugin.getVersion();
- workspace = CacheUtils.getWorkspace( session );
+ workspace = RepositoryUtils.getWorkspace( session );
localRepo = session.getLocalRepository();
this.repositories = new ArrayList<>( repositories.size() );
for ( RemoteRepository repository : repositories )
@@ -167,7 +168,7 @@ public class DefaultPluginDescriptorCache
hash = hash * 31 + version.hashCode();
hash = hash * 31 + hash( workspace );
hash = hash * 31 + localRepo.hashCode();
- hash = hash * 31 + CacheUtils.repositoriesHashCode( repositories );
+ hash = hash * 31 + RepositoryUtils.repositoriesHashCode( repositories );
this.hashCode = hash;
}
@@ -195,7 +196,7 @@ public class DefaultPluginDescriptorCache
return eq( this.artifactId, that.artifactId ) && eq( this.groupId, that.groupId )
&& eq( this.version, that.version ) && eq( this.localRepo, that.localRepo )
&& eq( this.workspace, that.workspace )
- && CacheUtils.repositoriesEquals( this.repositories, that.repositories );
+ && RepositoryUtils.repositoriesEquals( this.repositories, that.repositories );
}
@Override
http://git-wip-us.apache.org/repos/asf/maven/blob/98af937b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java
index 0a6da8d..1c09d9b 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java
@@ -23,9 +23,11 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.lang3.Validate;
+import org.apache.maven.RepositoryUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Plugin;
import org.apache.maven.project.MavenProject;
@@ -72,7 +74,7 @@ public class DefaultPluginRealmCache
RepositorySystemSession session )
{
this.plugin = plugin.clone();
- this.workspace = CacheUtils.getWorkspace( session );
+ this.workspace = RepositoryUtils.getWorkspace( session );
this.localRepo = session.getLocalRepository();
this.repositories = new ArrayList<>( repositories.size() );
for ( RemoteRepository repository : repositories )
@@ -93,12 +95,12 @@ public class DefaultPluginRealmCache
int hash = 17;
hash = hash * 31 + CacheUtils.pluginHashCode( plugin );
- hash = hash * 31 + hash( workspace );
- hash = hash * 31 + hash( localRepo );
- hash = hash * 31 + CacheUtils.repositoriesHashCode( repositories );
- hash = hash * 31 + hash( parentRealm );
+ hash = hash * 31 + Objects.hashCode( workspace );
+ hash = hash * 31 + Objects.hashCode( localRepo );
+ hash = hash * 31 + RepositoryUtils.repositoriesHashCode( repositories );
+ hash = hash * 31 + Objects.hashCode( parentRealm );
hash = hash * 31 + this.foreignImports.hashCode();
- hash = hash * 31 + hash( dependencyFilter );
+ hash = hash * 31 + Objects.hashCode( dependencyFilter );
this.hashCode = hash;
}
@@ -114,11 +116,6 @@ public class DefaultPluginRealmCache
return hashCode;
}
- private static int hash( Object obj )
- {
- return obj != null ? obj.hashCode() : 0;
- }
-
@Override
public boolean equals( Object o )
{
@@ -134,17 +131,14 @@ public class DefaultPluginRealmCache
CacheKey that = (CacheKey) o;
- return parentRealm == that.parentRealm && CacheUtils.pluginEquals( plugin, that.plugin )
- && eq( workspace, that.workspace ) && eq( localRepo, that.localRepo )
- && CacheUtils.repositoriesEquals( this.repositories, that.repositories ) && eq( filter, that.filter )
- && eq( foreignImports, that.foreignImports );
+ return parentRealm == that.parentRealm
+ && CacheUtils.pluginEquals( plugin, that.plugin )
+ && Objects.equals( workspace, that.workspace )
+ && Objects.equals( localRepo, that.localRepo )
+ && RepositoryUtils.repositoriesEquals( this.repositories, that.repositories )
+ && Objects.equals( filter, that.filter )
+ && Objects.equals( foreignImports, that.foreignImports );
}
-
- private static <T> boolean eq( T s1, T s2 )
- {
- return s1 != null ? s1.equals( s2 ) : s2 == null;
- }
-
}
protected final Map<Key, CacheRecord> cache = new ConcurrentHashMap<>();
http://git-wip-us.apache.org/repos/asf/maven/blob/98af937b/maven-core/src/main/java/org/apache/maven/plugin/DefaultProjectArtifactsCache.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultProjectArtifactsCache.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultProjectArtifactsCache.java
deleted file mode 100644
index 1eaa627..0000000
--- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultProjectArtifactsCache.java
+++ /dev/null
@@ -1,256 +0,0 @@
-package org.apache.maven.plugin;
-
-/*
- * 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.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.commons.lang3.Validate;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.lifecycle.LifecycleExecutionException;
-import org.apache.maven.model.Plugin;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.component.annotations.Component;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.repository.LocalRepository;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.repository.WorkspaceRepository;
-
-/**
- * @author Igor Fedorenko
- * @author Benjamin Bentmann
- * @author Anton Tanasenko
- */
-@Component( role = ProjectArtifactsCache.class )
-public class DefaultProjectArtifactsCache
- implements ProjectArtifactsCache
-{
-
- protected static class CacheKey
- implements Key
- {
-
- private final String groupId;
-
- private final String artifactId;
-
- private final String version;
-
- private final Set<String> dependencyArtifacts;
-
- private final WorkspaceRepository workspace;
-
- private final LocalRepository localRepo;
-
- private final List<RemoteRepository> repositories;
-
- private final Set<String> collect;
-
- private final Set<String> resolve;
-
- private boolean aggregating;
-
- private final int hashCode;
-
- public CacheKey( MavenProject project, List<RemoteRepository> repositories,
- Collection<String> scopesToCollect, Collection<String> scopesToResolve, boolean aggregating,
- RepositorySystemSession session )
- {
-
- groupId = project.getGroupId();
- artifactId = project.getArtifactId();
- version = project.getVersion();
-
- Set<String> deps = new HashSet<>();
- if ( project.getDependencyArtifacts() != null )
- {
- for ( Artifact dep: project.getDependencyArtifacts() )
- {
- deps.add( dep.toString() );
- }
- }
- dependencyArtifacts = Collections.unmodifiableSet( deps );
-
- workspace = CacheUtils.getWorkspace( session );
- this.localRepo = session.getLocalRepository();
- this.repositories = new ArrayList<>( repositories.size() );
- for ( RemoteRepository repository : repositories )
- {
- if ( repository.isRepositoryManager() )
- {
- this.repositories.addAll( repository.getMirroredRepositories() );
- }
- else
- {
- this.repositories.add( repository );
- }
- }
- collect = scopesToCollect == null
- ? Collections.<String>emptySet()
- : Collections.unmodifiableSet( new HashSet<>( scopesToCollect ) );
- resolve = scopesToResolve == null
- ? Collections.<String>emptySet()
- : Collections.unmodifiableSet( new HashSet<>( scopesToResolve ) );
- this.aggregating = aggregating;
-
- int hash = 17;
- hash = hash * 31 + hash( groupId );
- hash = hash * 31 + hash( artifactId );
- hash = hash * 31 + hash( version );
- hash = hash * 31 + hash( dependencyArtifacts );
- hash = hash * 31 + hash( workspace );
- hash = hash * 31 + hash( localRepo );
- hash = hash * 31 + CacheUtils.repositoriesHashCode( repositories );
- hash = hash * 31 + hash( collect );
- hash = hash * 31 + hash( resolve );
- hash = hash * 31 + hash( aggregating );
- this.hashCode = hash;
- }
-
- @Override
- public String toString()
- {
- return groupId + ":" + artifactId + ":" + version;
- }
-
- @Override
- public int hashCode()
- {
- return hashCode;
- }
-
- private static int hash( Object obj )
- {
- return obj != null ? obj.hashCode() : 0;
- }
-
- @Override
- public boolean equals( Object o )
- {
- if ( o == this )
- {
- return true;
- }
-
- if ( !( o instanceof CacheKey ) )
- {
- return false;
- }
-
- CacheKey that = (CacheKey) o;
-
- return eq( groupId, that.groupId ) && eq( artifactId, that.artifactId ) && eq( version, that.version )
- && eq( dependencyArtifacts, that.dependencyArtifacts )
- && eq( workspace, that.workspace ) && eq( localRepo, that.localRepo )
- && CacheUtils.repositoriesEquals( repositories, that.repositories ) && eq( collect, that.collect )
- && eq( resolve, that.resolve ) && aggregating == that.aggregating;
- }
-
- private static <T> boolean eq( T s1, T s2 )
- {
- return s1 != null ? s1.equals( s2 ) : s2 == null;
- }
-
- }
-
- protected final Map<Key, CacheRecord> cache = new ConcurrentHashMap<>();
-
- public Key createKey( MavenProject project, Collection<String> scopesToCollect,
- Collection<String> scopesToResolve, boolean aggregating, RepositorySystemSession session )
- {
- return new CacheKey( project, project.getRemoteProjectRepositories(), scopesToCollect, scopesToResolve,
- aggregating, session );
- }
-
- public CacheRecord get( Key key )
- throws LifecycleExecutionException
- {
- CacheRecord cacheRecord = cache.get( key );
-
- if ( cacheRecord != null && cacheRecord.exception != null )
- {
- throw cacheRecord.exception;
- }
-
- return cacheRecord;
- }
-
- public CacheRecord put( Key key, Set<Artifact> projectArtifacts )
- {
- Validate.notNull( projectArtifacts, "projectArtifacts cannot be null" );
-
- assertUniqueKey( key );
-
- CacheRecord record =
- new CacheRecord( Collections.unmodifiableSet( new HashSet<>( projectArtifacts ) ) );
-
- cache.put( key, record );
-
- return record;
- }
-
- protected void assertUniqueKey( Key key )
- {
- if ( cache.containsKey( key ) )
- {
- throw new IllegalStateException( "Duplicate artifact resolution result for project " + key );
- }
- }
-
- public CacheRecord put( Key key, LifecycleExecutionException exception )
- {
- Validate.notNull( exception, "exception cannot be null" );
-
- assertUniqueKey( key );
-
- CacheRecord record = new CacheRecord( exception );
-
- cache.put( key, record );
-
- return record;
- }
-
- public void flush()
- {
- cache.clear();
- }
-
- protected static int pluginHashCode( Plugin plugin )
- {
- return CacheUtils.pluginHashCode( plugin );
- }
-
- protected static boolean pluginEquals( Plugin a, Plugin b )
- {
- return CacheUtils.pluginEquals( a, b );
- }
-
- public void register( MavenProject project, Key cacheKey, CacheRecord record )
- {
- // default cache does not track record usage
- }
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/98af937b/maven-core/src/main/java/org/apache/maven/plugin/ProjectArtifactsCache.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/ProjectArtifactsCache.java b/maven-core/src/main/java/org/apache/maven/plugin/ProjectArtifactsCache.java
deleted file mode 100644
index 42a95e5..0000000
--- a/maven-core/src/main/java/org/apache/maven/plugin/ProjectArtifactsCache.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.apache.maven.plugin;
-
-/*
- * 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.util.Collection;
-import java.util.Set;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.lifecycle.LifecycleExecutionException;
-import org.apache.maven.project.MavenProject;
-import org.eclipse.aether.RepositorySystemSession;
-/**
- * Caches project artifacts. <strong>Warning:</strong> This is an internal utility interface that is only public for
- * technical reasons, it is not part of the public API. In particular, this interface can be changed or deleted without
- * prior notice.
- *
- * @author Igor Fedorenko
- * @author Benjamin Bentmann
- * @author Anton Tanasenko
- */
-public interface ProjectArtifactsCache
-{
-
- /**
- * A cache key.
- */
- interface Key
- {
- // marker interface for cache keys
- }
-
- static class CacheRecord
- {
-
- public final Set<Artifact> artifacts;
-
- public final LifecycleExecutionException exception;
-
- public CacheRecord( Set<Artifact> artifacts )
- {
- this.artifacts = artifacts;
- this.exception = null;
- }
-
- public CacheRecord( LifecycleExecutionException exception )
- {
- this.artifacts = null;
- this.exception = exception;
- }
- }
-
- Key createKey( MavenProject project, Collection<String> scopesToCollect, Collection<String> scopesToResolve,
- boolean aggregating, RepositorySystemSession session );
-
- CacheRecord get( Key key ) throws LifecycleExecutionException;
-
- CacheRecord put( Key key, Set<Artifact> pluginArtifacts );
-
- CacheRecord put( Key key, LifecycleExecutionException e );
-
- void flush();
-
- /**
- * Registers the specified cache record for usage with the given project. Integrators can use the information
- * collected from this method in combination with a custom cache implementation to dispose unused records from the
- * cache.
- *
- * @param project The project that employs the plugin realm, must not be {@code null}.
- * @param record The cache record being used for the project, must not be {@code null}.
- */
- void register( MavenProject project, Key cacheKey, CacheRecord record );
-
-}
http://git-wip-us.apache.org/repos/asf/maven/blob/98af937b/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultProjectArtifactsCache.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultProjectArtifactsCache.java b/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultProjectArtifactsCache.java
new file mode 100644
index 0000000..87d2e44
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultProjectArtifactsCache.java
@@ -0,0 +1,246 @@
+package org.apache.maven.project.artifact;
+
+/*
+ * 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.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.commons.lang3.Validate;
+import org.apache.maven.RepositoryUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.lifecycle.LifecycleExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.annotations.Component;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.LocalRepository;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.repository.WorkspaceRepository;
+
+/**
+ * @author Igor Fedorenko
+ * @author Benjamin Bentmann
+ * @author Anton Tanasenko
+ */
+@Component( role = ProjectArtifactsCache.class )
+public class DefaultProjectArtifactsCache
+ implements ProjectArtifactsCache
+{
+
+ protected static class CacheKey
+ implements Key
+ {
+
+ private final String groupId;
+
+ private final String artifactId;
+
+ private final String version;
+
+ private final Set<String> dependencyArtifacts;
+
+ private final WorkspaceRepository workspace;
+
+ private final LocalRepository localRepo;
+
+ private final List<RemoteRepository> repositories;
+
+ private final Set<String> collect;
+
+ private final Set<String> resolve;
+
+ private boolean aggregating;
+
+ private final int hashCode;
+
+ public CacheKey( MavenProject project, List<RemoteRepository> repositories,
+ Collection<String> scopesToCollect, Collection<String> scopesToResolve, boolean aggregating,
+ RepositorySystemSession session )
+ {
+
+ groupId = project.getGroupId();
+ artifactId = project.getArtifactId();
+ version = project.getVersion();
+
+ Set<String> deps = new HashSet<>();
+ if ( project.getDependencyArtifacts() != null )
+ {
+ for ( Artifact dep: project.getDependencyArtifacts() )
+ {
+ deps.add( dep.toString() );
+ }
+ }
+ dependencyArtifacts = Collections.unmodifiableSet( deps );
+
+ workspace = RepositoryUtils.getWorkspace( session );
+ this.localRepo = session.getLocalRepository();
+ this.repositories = new ArrayList<>( repositories.size() );
+ for ( RemoteRepository repository : repositories )
+ {
+ if ( repository.isRepositoryManager() )
+ {
+ this.repositories.addAll( repository.getMirroredRepositories() );
+ }
+ else
+ {
+ this.repositories.add( repository );
+ }
+ }
+ collect = scopesToCollect == null
+ ? Collections.<String>emptySet()
+ : Collections.unmodifiableSet( new HashSet<>( scopesToCollect ) );
+ resolve = scopesToResolve == null
+ ? Collections.<String>emptySet()
+ : Collections.unmodifiableSet( new HashSet<>( scopesToResolve ) );
+ this.aggregating = aggregating;
+
+ int hash = 17;
+ hash = hash * 31 + Objects.hashCode( groupId );
+ hash = hash * 31 + Objects.hashCode( artifactId );
+ hash = hash * 31 + Objects.hashCode( version );
+ hash = hash * 31 + Objects.hashCode( dependencyArtifacts );
+ hash = hash * 31 + Objects.hashCode( workspace );
+ hash = hash * 31 + Objects.hashCode( localRepo );
+ hash = hash * 31 + RepositoryUtils.repositoriesHashCode( repositories );
+ hash = hash * 31 + Objects.hashCode( collect );
+ hash = hash * 31 + Objects.hashCode( resolve );
+ hash = hash * 31 + Objects.hashCode( aggregating );
+ this.hashCode = hash;
+ }
+
+ @Override
+ public String toString()
+ {
+ return groupId + ":" + artifactId + ":" + version;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( o == this )
+ {
+ return true;
+ }
+
+ if ( !( o instanceof CacheKey ) )
+ {
+ return false;
+ }
+
+ CacheKey that = (CacheKey) o;
+
+ return Objects.equals( groupId, that.groupId ) && Objects.equals( artifactId, that.artifactId )
+ && Objects.equals( version, that.version )
+ && Objects.equals( dependencyArtifacts, that.dependencyArtifacts )
+ && Objects.equals( workspace, that.workspace )
+ && Objects.equals( localRepo, that.localRepo )
+ && RepositoryUtils.repositoriesEquals( repositories, that.repositories )
+ && Objects.equals( collect, that.collect )
+ && Objects.equals( resolve, that.resolve )
+ && aggregating == that.aggregating;
+ }
+ }
+
+ protected final Map<Key, CacheRecord> cache = new ConcurrentHashMap<>();
+
+ @Override
+ public Key createKey( MavenProject project, Collection<String> scopesToCollect,
+ Collection<String> scopesToResolve, boolean aggregating, RepositorySystemSession session )
+ {
+ return new CacheKey( project, project.getRemoteProjectRepositories(), scopesToCollect, scopesToResolve,
+ aggregating, session );
+ }
+
+ @Override
+ public CacheRecord get( Key key )
+ throws LifecycleExecutionException
+ {
+ CacheRecord cacheRecord = cache.get( key );
+
+ if ( cacheRecord != null && cacheRecord.exception != null )
+ {
+ throw cacheRecord.exception;
+ }
+
+ return cacheRecord;
+ }
+
+ @Override
+ public CacheRecord put( Key key, Set<Artifact> projectArtifacts )
+ {
+ Validate.notNull( projectArtifacts, "projectArtifacts cannot be null" );
+
+ assertUniqueKey( key );
+
+ CacheRecord record =
+ new CacheRecord( Collections.unmodifiableSet( new HashSet<>( projectArtifacts ) ) );
+
+ cache.put( key, record );
+
+ return record;
+ }
+
+ protected void assertUniqueKey( Key key )
+ {
+ if ( cache.containsKey( key ) )
+ {
+ throw new IllegalStateException( "Duplicate artifact resolution result for project " + key );
+ }
+ }
+
+ @Override
+ public CacheRecord put( Key key, LifecycleExecutionException exception )
+ {
+ Validate.notNull( exception, "exception cannot be null" );
+
+ assertUniqueKey( key );
+
+ CacheRecord record = new CacheRecord( exception );
+
+ cache.put( key, record );
+
+ return record;
+ }
+
+ @Override
+ public void flush()
+ {
+ cache.clear();
+ }
+
+ @Override
+ public void register( MavenProject project, Key cacheKey, CacheRecord record )
+ {
+ // default cache does not track record usage
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/98af937b/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactsCache.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactsCache.java b/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactsCache.java
new file mode 100644
index 0000000..ac093e9
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactsCache.java
@@ -0,0 +1,90 @@
+package org.apache.maven.project.artifact;
+
+/*
+ * 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.util.Collection;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.lifecycle.LifecycleExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.eclipse.aether.RepositorySystemSession;
+/**
+ * Caches project artifacts. <strong>Warning:</strong> This is an internal utility interface that is only public for
+ * technical reasons, it is not part of the public API. In particular, this interface can be changed or deleted without
+ * prior notice.
+ *
+ * @author Igor Fedorenko
+ * @author Benjamin Bentmann
+ * @author Anton Tanasenko
+ */
+public interface ProjectArtifactsCache
+{
+
+ /**
+ * A cache key.
+ */
+ interface Key
+ {
+ // marker interface for cache keys
+ }
+
+ static class CacheRecord
+ {
+
+ public final Set<Artifact> artifacts;
+
+ public final LifecycleExecutionException exception;
+
+ public CacheRecord( Set<Artifact> artifacts )
+ {
+ this.artifacts = artifacts;
+ this.exception = null;
+ }
+
+ public CacheRecord( LifecycleExecutionException exception )
+ {
+ this.artifacts = null;
+ this.exception = exception;
+ }
+ }
+
+ Key createKey( MavenProject project, Collection<String> scopesToCollect, Collection<String> scopesToResolve,
+ boolean aggregating, RepositorySystemSession session );
+
+ CacheRecord get( Key key ) throws LifecycleExecutionException;
+
+ CacheRecord put( Key key, Set<Artifact> pluginArtifacts );
+
+ CacheRecord put( Key key, LifecycleExecutionException e );
+
+ void flush();
+
+ /**
+ * Registers the specified cache record for usage with the given project. Integrators can use the information
+ * collected from this method in combination with a custom cache implementation to dispose unused records from the
+ * cache.
+ *
+ * @param project The project that employs the plugin realm, must not be {@code null}.
+ * @param record The cache record being used for the project, must not be {@code null}.
+ */
+ void register( MavenProject project, Key cacheKey, CacheRecord record );
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/98af937b/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java
----------------------------------------------------------------------
diff --git a/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java b/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java
index 157a5ec..315e152 100644
--- a/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java
+++ b/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java
@@ -20,6 +20,7 @@ package org.apache.maven;
*/
import java.io.File;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
@@ -128,6 +129,12 @@ public abstract class AbstractCoreMavenComponentTestCase
}
protected MavenSession createMavenSession( File pom, Properties executionProperties )
+ throws Exception
+ {
+ return createMavenSession( pom, executionProperties, false );
+ }
+
+ protected MavenSession createMavenSession( File pom, Properties executionProperties, boolean includeModules )
throws Exception
{
MavenExecutionRequest request = createMavenExecutionRequest( pom );
@@ -138,17 +145,32 @@ public abstract class AbstractCoreMavenComponentTestCase
.setPluginArtifactRepositories( request.getPluginArtifactRepositories() )
.setSystemProperties( executionProperties );
- MavenProject project = null;
+ List<MavenProject> projects = new ArrayList<>();
if ( pom != null )
{
- project = projectBuilder.build( pom, configuration ).getProject();
+ MavenProject project = projectBuilder.build( pom, configuration ).getProject();
+
+ projects.add( project );
+ if ( includeModules )
+ {
+ for( String module : project.getModules() )
+ {
+ File modulePom = new File( pom.getParentFile(), module );
+ if( modulePom.isDirectory() )
+ {
+ modulePom = new File( modulePom, "pom.xml" );
+ }
+ projects.add( projectBuilder.build( modulePom, configuration ).getProject() );
+ }
+ }
}
else
{
- project = createStubMavenProject();
+ MavenProject project = createStubMavenProject();
project.setRemoteArtifactRepositories( request.getRemoteRepositories() );
project.setPluginArtifactRepositories( request.getPluginArtifactRepositories() );
+ projects.add( project );
}
initRepoSession( configuration );
@@ -156,7 +178,7 @@ public abstract class AbstractCoreMavenComponentTestCase
MavenSession session =
new MavenSession( getContainer(), configuration.getRepositorySession(), request,
new DefaultMavenExecutionResult() );
- session.setProjects( Arrays.asList( project ) );
+ session.setProjects( projects );
session.setAllProjects( session.getProjects() );
return session;
http://git-wip-us.apache.org/repos/asf/maven/blob/98af937b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolverTest.java
----------------------------------------------------------------------
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolverTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolverTest.java
new file mode 100644
index 0000000..b38742a
--- /dev/null
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolverTest.java
@@ -0,0 +1,90 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.maven.AbstractCoreMavenComponentTestCase;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.junit.Test;
+
+public class LifecycleDependencyResolverTest extends AbstractCoreMavenComponentTestCase
+{
+ @Requirement
+ private LifecycleDependencyResolver resolver;
+
+ @Override
+ protected String getProjectsDirectory()
+ {
+ return null;
+ }
+
+ @Override
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+ resolver = lookup( LifecycleDependencyResolver.class );
+ }
+
+ @Test
+ public void testCachedReactorProjectDependencies() throws Exception
+ {
+ MavenSession session = createMavenSession( new File( "src/test/projects/lifecycle-dependency-resolver/pom.xml" ), new Properties(), true );
+ Collection<String> scopesToCollect = null;
+ Collection<String> scopesToResolve = Collections.singletonList( "compile" );
+ boolean aggregating = false;
+
+ Set<Artifact> reactorArtifacts = new HashSet<>( 3 );
+ for ( MavenProject reactorProject : session.getProjects() )
+ {
+ reactorProject.setArtifactFilter( new ArtifactFilter()
+ {
+ @Override
+ public boolean include( Artifact artifact )
+ {
+ return true;
+ }
+ } );
+ resolver.resolveProjectDependencies( reactorProject, scopesToCollect, scopesToResolve, session, aggregating, reactorArtifacts );
+ reactorArtifacts.add( reactorProject.getArtifact() );
+ }
+
+ MavenProject lib = session.getProjects().get( 1 );
+ MavenProject war = session.getProjects().get( 2 );
+
+ assertEquals( null , war.getArtifactMap().get("org.apache.maven.its.mng6300:mng6300-lib").getFile() );
+
+ lib.getArtifact().setFile( new File( "lib.jar" ) );
+
+ resolver.resolveProjectDependencies( war, scopesToCollect, scopesToResolve, session, aggregating, reactorArtifacts );
+
+ assertEquals( new File( "lib.jar" ) , war.getArtifactMap().get("org.apache.maven.its.mng6300:mng6300-lib").getFile() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/98af937b/maven-core/src/test/projects/lifecycle-dependency-resolver/lib/pom.xml
----------------------------------------------------------------------
diff --git a/maven-core/src/test/projects/lifecycle-dependency-resolver/lib/pom.xml b/maven-core/src/test/projects/lifecycle-dependency-resolver/lib/pom.xml
new file mode 100644
index 0000000..e020408
--- /dev/null
+++ b/maven-core/src/test/projects/lifecycle-dependency-resolver/lib/pom.xml
@@ -0,0 +1,32 @@
+<?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>
+
+ <parent>
+ <groupId>org.apache.maven.its.mng6300</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0</version>
+ </parent>
+ <artifactId>mng6300-lib</artifactId>
+
+</project>
http://git-wip-us.apache.org/repos/asf/maven/blob/98af937b/maven-core/src/test/projects/lifecycle-dependency-resolver/pom.xml
----------------------------------------------------------------------
diff --git a/maven-core/src/test/projects/lifecycle-dependency-resolver/pom.xml b/maven-core/src/test/projects/lifecycle-dependency-resolver/pom.xml
new file mode 100644
index 0000000..8c7cfec
--- /dev/null
+++ b/maven-core/src/test/projects/lifecycle-dependency-resolver/pom.xml
@@ -0,0 +1,58 @@
+<?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.mng6300</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0</version>
+ <packaging>pom</packaging>
+
+ <name>Maven Integration Test :: MNG-6300</name>
+ <description>
+ Check that war packages the jar instead of a directory
+ </description>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <reportSets>
+ <reportSet>
+ <reports>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <modules>
+ <module>lib</module>
+ <module>war</module>
+ </modules>
+</project>
http://git-wip-us.apache.org/repos/asf/maven/blob/98af937b/maven-core/src/test/projects/lifecycle-dependency-resolver/war/pom.xml
----------------------------------------------------------------------
diff --git a/maven-core/src/test/projects/lifecycle-dependency-resolver/war/pom.xml b/maven-core/src/test/projects/lifecycle-dependency-resolver/war/pom.xml
new file mode 100644
index 0000000..e168833
--- /dev/null
+++ b/maven-core/src/test/projects/lifecycle-dependency-resolver/war/pom.xml
@@ -0,0 +1,53 @@
+<?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>
+
+ <parent>
+ <groupId>org.apache.maven.its.mng6300</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0</version>
+ </parent>
+ <artifactId>mng6300-war</artifactId>
+ <packaging>war</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <failOnMissingWebXml>false</failOnMissingWebXml>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.its.mng6300</groupId>
+ <artifactId>mng6300-lib</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+
+</project>
[5/9] 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. o Added some tests.
Posted by hb...@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.
o Added some tests.
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/2295c17b
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/2295c17b
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/2295c17b
Branch: refs/heads/MNG-6308_display_packaging
Commit: 2295c17b45f46cae0daa46105e0a7856505a108f
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 21:41:18 2017 +0100
----------------------------------------------------------------------
.../AbstractStringBasedModelInterpolator.java | 6 ++
.../model/validation/DefaultModelValidator.java | 30 ++++---
.../validation/DefaultModelValidatorTest.java | 84 ++++++++++++++++----
.../raw-model/bad-ci-friendly-sha1plus.xml | 31 ++++++++
.../raw-model/bad-ci-friendly-sha1plus2.xml | 31 ++++++++
.../validation/raw-model/bad-ci-friendly.xml | 31 ++++++++
.../ok-ci-friendly-all-expressions.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 ++++++++
10 files changed, 311 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/2295c17b/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/2295c17b/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..9299b43 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
@@ -26,6 +26,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.maven.model.Activation;
@@ -65,6 +66,13 @@ public class DefaultModelValidator
implements ModelValidator
{
+ private static final Pattern CI_FRIENDLY_EXPRESSION = Pattern.compile( "\\$\\{(.+?)\\}" );
+
+ private static final List<String> CI_FRIENDLY_POSSIBLE_PROPERTY_NAMES =
+ Arrays.asList( AbstractStringBasedModelInterpolator.REVISION_PROPERTY,
+ AbstractStringBasedModelInterpolator.CHANGELIST_PROPERTY,
+ AbstractStringBasedModelInterpolator.SHA1_PROPERTY );
+
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_\\-.?*]+" );
@@ -532,7 +540,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.
@@ -855,7 +863,6 @@ public class DefaultModelValidator
private boolean validateVersionNoExpression( String fieldName, ModelProblemCollector problems, Severity severity,
Version version, String string, InputLocationTracker tracker )
{
-
if ( !hasExpression( string ) )
{
return true;
@@ -868,18 +875,19 @@ public class DefaultModelValidator
// revision
// sha1
//
- string = string.trim();
- if ( string.contains( "${" + AbstractStringBasedModelInterpolator.CHANGELIST_PROPERTY + "}" )
- || string.contains( "${" + AbstractStringBasedModelInterpolator.REVISION_PROPERTY + "}" )
- || string.contains( "${" + AbstractStringBasedModelInterpolator.SHA1_PROPERTY + "}" ) )
+ Matcher m = CI_FRIENDLY_EXPRESSION.matcher( string.trim() );
+ while ( m.find() )
{
- return true;
- }
+ if ( !CI_FRIENDLY_POSSIBLE_PROPERTY_NAMES.contains( m.group( 1 ) ) )
+ {
+ addViolation( problems, severity, version, fieldName, null,
+ "contains an expression but should be a constant.", tracker );
- addViolation( problems, severity, version, fieldName, null, "contains an expression but should be a constant.",
- tracker );
+ return false;
+ }
+ }
- return false;
+ return true;
}
private boolean hasExpression( String value )
http://git-wip-us.apache.org/repos/asf/maven/blob/2295c17b/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..0bb3bd4 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
@@ -419,18 +419,19 @@ public class DefaultModelValidatorTest
assertViolations( result, 0, 0, 1 );
assertContains( result.getWarnings().get( 0 ),
- "'dependencies.dependency.systemPath' for test:a:jar should use a variable instead of a hard-coded path" );
+ "'dependencies.dependency.systemPath' for test:a:jar should use a variable instead of a hard-coded path" );
- SimpleProblemCollector result_31 = validateRaw( "hard-coded-system-path.xml", ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 );
+ SimpleProblemCollector result_31 =
+ validateRaw( "hard-coded-system-path.xml", ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 );
assertViolations( result_31, 0, 0, 3 );
assertContains( result_31.getWarnings().get( 0 ),
- "'dependencies.dependency.scope' for test:a:jar declares usage of deprecated 'system' scope" );
+ "'dependencies.dependency.scope' for test:a:jar declares usage of deprecated 'system' scope" );
assertContains( result_31.getWarnings().get( 1 ),
- "'dependencies.dependency.systemPath' for test:a:jar should use a variable instead of a hard-coded path" );
+ "'dependencies.dependency.systemPath' for test:a:jar should use a variable instead of a hard-coded path" );
assertContains( result_31.getWarnings().get( 2 ),
- "'dependencies.dependency.scope' for test:b:jar declares usage of deprecated 'system' scope" );
+ "'dependencies.dependency.scope' for test:b:jar declares usage of deprecated 'system' scope" );
}
@@ -625,22 +626,23 @@ public class DefaultModelValidatorTest
assertViolations( result, 0, 0, 2 );
assertContains( result.getWarnings().get( 0 ),
- "'dependencies.dependency.systemPath' for test:a:jar should not point at files within the project directory" );
+ "'dependencies.dependency.systemPath' for test:a:jar should not point at files within the project directory" );
assertContains( result.getWarnings().get( 1 ),
- "'dependencies.dependency.systemPath' for test:b:jar should not point at files within the project directory" );
+ "'dependencies.dependency.systemPath' for test:b:jar should not point at files within the project directory" );
- SimpleProblemCollector result_31 = validateRaw( "basedir-system-path.xml", ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 );
+ SimpleProblemCollector result_31 =
+ validateRaw( "basedir-system-path.xml", ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 );
assertViolations( result_31, 0, 0, 4 );
assertContains( result_31.getWarnings().get( 0 ),
- "'dependencies.dependency.scope' for test:a:jar declares usage of deprecated 'system' scope" );
+ "'dependencies.dependency.scope' for test:a:jar declares usage of deprecated 'system' scope" );
assertContains( result_31.getWarnings().get( 1 ),
- "'dependencies.dependency.systemPath' for test:a:jar should not point at files within the project directory" );
+ "'dependencies.dependency.systemPath' for test:a:jar should not point at files within the project directory" );
assertContains( result_31.getWarnings().get( 2 ),
- "'dependencies.dependency.scope' for test:b:jar declares usage of deprecated 'system' scope" );
+ "'dependencies.dependency.scope' for test:b:jar declares usage of deprecated 'system' scope" );
assertContains( result_31.getWarnings().get( 3 ),
- "'dependencies.dependency.systemPath' for test:b:jar should not point at files within the project directory" );
+ "'dependencies.dependency.systemPath' for test:b:jar should not point at files within the project directory" );
}
public void testInvalidVersionInPluginManagement()
@@ -703,16 +705,16 @@ public class DefaultModelValidatorTest
}
public void testDeprecatedDependencyMetaversionsLatestAndRelease()
- throws Exception
+ throws Exception
{
SimpleProblemCollector result = validateRaw( "deprecated-dependency-metaversions-latest-and-release.xml" );
assertViolations( result, 0, 0, 2 );
assertContains( result.getWarnings().get( 0 ),
- "'dependencies.dependency.version' for test:a:jar is either LATEST or RELEASE (both of them are being deprecated)" );
+ "'dependencies.dependency.version' for test:a:jar is either LATEST or RELEASE (both of them are being deprecated)" );
assertContains( result.getWarnings().get( 1 ),
- "'dependencies.dependency.version' for test:b:jar is either LATEST or RELEASE (both of them are being deprecated)" );
+ "'dependencies.dependency.version' for test:b:jar is either LATEST or RELEASE (both of them are being deprecated)" );
}
public void testSelfReferencingDependencyInRawModel()
@@ -727,4 +729,56 @@ 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 testCiFriendlyAllExpressions()
+ throws Exception
+ {
+ SimpleProblemCollector result = validateRaw( "raw-model/ok-ci-friendly-all-expressions.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/2295c17b/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/2295c17b/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/2295c17b/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/2295c17b/maven-model-builder/src/test/resources/poms/validation/raw-model/ok-ci-friendly-all-expressions.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/validation/raw-model/ok-ci-friendly-all-expressions.xml b/maven-model-builder/src/test/resources/poms/validation/raw-model/ok-ci-friendly-all-expressions.xml
new file mode 100644
index 0000000..860b482
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/validation/raw-model/ok-ci-friendly-all-expressions.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>${revision}${changelist}${sha1}</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/2295c17b/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/2295c17b/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/2295c17b/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