From a254b9c21cc1ca75909e7a80b9b4ef10323e2d45 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Sat, 23 Jan 2016 15:42:08 +0100 Subject: [PATCH] Add support for parent project POM properties Fixes https://github.com/alexarchambault/coursier/issues/120 --- .../main/scala/coursier/core/Resolution.scala | 9 ++++++++- .../com.github.fommil.netlib/all/1.1.2 | 17 +++++++++++++++++ .../test/scala/coursier/test/CentralTests.scala | 6 ++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 tests/shared/src/test/resources/resolutions/com.github.fommil.netlib/all/1.1.2 diff --git a/core/shared/src/main/scala/coursier/core/Resolution.scala b/core/shared/src/main/scala/coursier/core/Resolution.scala index f8bbaf818..ed3304d5e 100644 --- a/core/shared/src/main/scala/coursier/core/Resolution.scala +++ b/core/shared/src/main/scala/coursier/core/Resolution.scala @@ -335,7 +335,14 @@ object Resolution { "project.groupId" -> project.module.organization, "project.artifactId" -> project.module.name, "project.version" -> project.version - ) + ) ++ project.parent.toSeq.flatMap { + case (parModule, parVersion) => + Seq( + "project.parent.groupId" -> parModule.organization, + "project.parent.artifactId" -> parModule.name, + "project.parent.version" -> parVersion + ) + } val properties = propertiesMap(properties0) diff --git a/tests/shared/src/test/resources/resolutions/com.github.fommil.netlib/all/1.1.2 b/tests/shared/src/test/resources/resolutions/com.github.fommil.netlib/all/1.1.2 new file mode 100644 index 000000000..de65a7709 --- /dev/null +++ b/tests/shared/src/test/resources/resolutions/com.github.fommil.netlib/all/1.1.2 @@ -0,0 +1,17 @@ +com.github.fommil.netlib:all:jar:1.1.2 +com.github.fommil.netlib:core:jar:1.1.2 +com.github.fommil.netlib:native_ref-java:jar:1.1 +com.github.fommil.netlib:native_system-java:jar:1.1 +com.github.fommil.netlib:netlib-native_ref-linux-armhf:jar:natives:1.1 +com.github.fommil.netlib:netlib-native_ref-linux-i686:jar:natives:1.1 +com.github.fommil.netlib:netlib-native_ref-linux-x86_64:jar:natives:1.1 +com.github.fommil.netlib:netlib-native_ref-osx-x86_64:jar:natives:1.1 +com.github.fommil.netlib:netlib-native_ref-win-i686:jar:natives:1.1 +com.github.fommil.netlib:netlib-native_ref-win-x86_64:jar:natives:1.1 +com.github.fommil.netlib:netlib-native_system-linux-armhf:jar:natives:1.1 +com.github.fommil.netlib:netlib-native_system-linux-i686:jar:natives:1.1 +com.github.fommil.netlib:netlib-native_system-linux-x86_64:jar:natives:1.1 +com.github.fommil.netlib:netlib-native_system-osx-x86_64:jar:natives:1.1 +com.github.fommil.netlib:netlib-native_system-win-i686:jar:natives:1.1 +com.github.fommil.netlib:netlib-native_system-win-x86_64:jar:natives:1.1 +com.github.fommil:jniloader:jar:1.1 diff --git a/tests/shared/src/test/scala/coursier/test/CentralTests.scala b/tests/shared/src/test/scala/coursier/test/CentralTests.scala index 7cd86c54e..8da90698c 100644 --- a/tests/shared/src/test/scala/coursier/test/CentralTests.scala +++ b/tests/shared/src/test/scala/coursier/test/CentralTests.scala @@ -143,6 +143,12 @@ object CentralTests extends TestSuite { extraRepo = Some(MavenRepository("https://oss.sonatype.org/content/repositories/public/")) ) } + 'parentProjectProperties - { + resolutionCheck( + Module("com.github.fommil.netlib", "all"), + "1.1.2" + ) + } } }