From 9bf517f89d7ae38fbed6bb0a08547020c024dff3 Mon Sep 17 00:00:00 2001 From: Chris Sarbora Date: Thu, 16 Jul 2015 17:58:05 -0700 Subject: [PATCH] Hack in support for the old version of Maven that Ubuntu apparently ships with Change-Id: I39094627ff114901cc49f792ab601ab5b1677c19 --- build/core/maven_artifact.mk | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/build/core/maven_artifact.mk b/build/core/maven_artifact.mk index 33353535..d0019e2f 100644 --- a/build/core/maven_artifact.mk +++ b/build/core/maven_artifact.mk @@ -34,15 +34,34 @@ LOCAL_PREBUILT_MODULE_FILE := $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS) $(LOCAL_PREBUILT_MODULE_FILE): specifier := $(LOCAL_MAVEN_GROUP):$(LOCAL_MAVEN_ARTIFACT):$(LOCAL_MAVEN_VERSION):$(LOCAL_MAVEN_PACKAGING)$(if $(LOCAL_MAVEN_CLASSIFIER),:$(LOCAL_MAVEN_CLASSIFIER)) $(LOCAL_PREBUILT_MODULE_FILE): repo := $(LOCAL_MAVEN_REPO) -$(LOCAL_PREBUILT_MODULE_FILE): - @mvn -q dependency:get dependency:copy \ - -DremoteRepositories=central::::$(repo) \ + +ifeq ($(shell mvn --version | head -1),Apache Maven 3.0.5) + copy_task := + repo_param := -DrepoUrl= + output_param := -Ddestination= + $(LOCAL_PREBUILT_MODULE_FILE): nogroup_file := $(LOCAL_MAVEN_ARTIFACT)-$(LOCAL_MAVEN_VERSION)$(if $(LOCAL_MAVEN_CLASSIFIER),-$(LOCAL_MAVEN_CLASSIFIER)).$(LOCAL_MAVEN_PACKAGING) + $(LOCAL_PREBUILT_MODULE_FILE): copy_command := $(hide) cp ~/.m2/repository/$(subst .,/,$(LOCAL_MAVEN_GROUP))/$(LOCAL_MAVEN_ARTIFACT)/$(LOCAL_MAVEN_VERSION)/$(nogroup_file) +else + copy_task := dependency:copy + repo_param := -DremoteRepositories=central:::: + output_param := -DoutputDirectory= + $(LOCAL_PREBUILT_MODULE_FILE): copy_command := $(hide) mvn -q dependency:copy \ -Dartifact=$(specifier) \ - -DoutputDirectory=$(dir $@) \ -Dmdep.prependGroupId=true \ -Dmdep.overWriteSnapshots=true \ -Dmdep.overWriteReleases=true \ + $(output_param) + $(LOCAL_PREBUILT_MODULE_FILE): nogroup_file := nonexistent +endif + +$(LOCAL_PREBUILT_MODULE_FILE): + $(hide) mvn -q dependency:get \ + $(repo_param)$(repo) \ + -Dartifact=$(specifier) \ -Dtransitive=false + $(hide) mkdir -p $(dir $@) + $(copy_command)$(dir $@) + $(hide) mv $(dir $@)/$(nogroup_file) $@ 2>/dev/null || true @echo -e ${CL_GRN}"Download:"${CL_RST}" $@" include $(BUILD_PREBUILT)