[CORD-2035]
Fix mavenrepo and onos dependency issues

Change-Id: Ie65d5d61b1e7f1154a7cb936cf1e79bfcb64b9f1
diff --git a/Makefile b/Makefile
index 0834fb7..d03c110 100644
--- a/Makefile
+++ b/Makefile
@@ -162,15 +162,16 @@
 
 
 # == PREREQS == #
-VAGRANT_UP_PREREQS     ?=
-COPY_CORD_PREREQS      ?=
-CORD_CONFIG_PREREQS    ?=
-COPY_CONFIG_PREREQS    ?=
-PREP_BUILDNODE_PREREQS ?=
-PREP_HEADNODE_PREREQS  ?=
-DOCKER_IMAGES_PREREQS  ?=
-START_XOS_PREREQS      ?=
-DEPLOY_ONOS_PREREQS    ?=
+VAGRANT_UP_PREREQS       ?=
+COPY_CORD_PREREQS        ?=
+CORD_CONFIG_PREREQS      ?=
+COPY_CONFIG_PREREQS      ?=
+PREP_BUILDNODE_PREREQS   ?=
+PREP_HEADNODE_PREREQS    ?=
+DOCKER_IMAGES_PREREQS    ?=
+START_XOS_PREREQS        ?=
+BUILD_ONOS_APPS_PREREQS  ?=
+DEPLOY_ONOS_PREREQS      ?=
 DEPLOY_OPENSTACK_PREREQS ?=
 DEPLOY_MAVENREPO_PREREQS ?=
 SETUP_AUTOMATION_PREREQS ?=
@@ -259,15 +260,15 @@
 	$(SSH_BUILD) "cd $(BUILD_CORD_DIR)/onos-apps; make MAKE_CONFIG=../build/$(MAKEFILE_CONFIG) build" $(LOGCMD)
 	touch $@
 
-$(M)/publish-onos-apps: | $(M)/deploy-maas $(M)/build-onos-apps
+$(M)/publish-onos-apps: | $(M)/build-onos-apps
 	$(SSH_BUILD) "cd $(BUILD_CORD_DIR)/onos-apps; make MAKE_CONFIG=../build/$(MAKEFILE_CONFIG) publish" $(LOGCMD)
 	touch $@
 
-$(M)/deploy-mavenrepo: | $(M)/publish-onos-apps $(DEPLOY_MAVENREPO_PREREQS)
+$(M)/deploy-mavenrepo: | $(M)/build-onos-apps $(DEPLOY_MAVENREPO_PREREQS)
 	$(ANSIBLE_PB) $(PI)/deploy-mavenrepo-playbook.yml $(LOGCMD)
 	touch $@
 
-$(M)/deploy-onos: | $(M)/docker-images $(DEPLOY_ONOS_PREREQS)
+$(M)/deploy-onos: | $(M)/docker-images $(M)/deploy-mavenrepo $(DEPLOY_ONOS_PREREQS)
 	$(ANSIBLE_PB) $(PI)/deploy-onos-playbook.yml $(LOGCMD)
 	touch $@
 
diff --git a/ansible/roles/genconfig/templates/config.mk.j2 b/ansible/roles/genconfig/templates/config.mk.j2
index 1a6e8a8..2954e09 100644
--- a/ansible/roles/genconfig/templates/config.mk.j2
+++ b/ansible/roles/genconfig/templates/config.mk.j2
@@ -73,6 +73,9 @@
 {% if start_xos_prereqs is defined %}
 START_XOS_PREREQS       = $(M)/{{ start_xos_prereqs | join(" $(M)/") }}
 {% endif %}
+{% if build_onos_apps_prereqs is defined %}
+BUILD_ONOS_APPS_PREREQS = $(M)/{{ build_onos_apps_prereqs | join(" $(M)/") }}
+{% endif %}
 {% if deploy_onos_prereqs is defined %}
 DEPLOY_ONOS_PREREQS     = $(M)/{{ deploy_onos_prereqs | join(" $(M)/") }}
 {% endif %}
diff --git a/scenarios/cord/config.yml b/scenarios/cord/config.yml
index e1029b3..38931b2 100644
--- a/scenarios/cord/config.yml
+++ b/scenarios/cord/config.yml
@@ -65,13 +65,14 @@
 deploy_openstack_prereqs:
   - deploy-maas
 
-deploy_onos_prereqs:
+build_onos_apps_prereqs:
   - deploy-maas
-  - deploy-mavenrepo
-  - publish-docker-images
 
 deploy_mavenrepo_prereqs:
-  - deploy-maas
+  - publish-onos-apps
+
+deploy_onos_prereqs:
+  - publish-docker-images
 
 setup_automation_prereqs:
   - deploy-openstack