diff --git a/script/Makefile b/script/Makefile index f548595eef..8aab58b686 100644 --- a/script/Makefile +++ b/script/Makefile @@ -379,7 +379,7 @@ check-platform: maven-overlay: @echo "####### Preparing maven dependencies bundle..." mkdir -p build/_maven_overlay - ./script/maven_overlay.sh $(RUNTIME_VERSION) build/_maven_overlay $(CAMEL_K_RUNTIME_DIR) + ./script/maven_overlay.sh $(RUNTIME_VERSION) build/_maven_overlay $(STAGING_RUNTIME_REPO) $(CAMEL_K_RUNTIME_DIR) kamel-overlay: @echo "####### Copying kamel CLI to output build directory..." diff --git a/script/maven_overlay.sh b/script/maven_overlay.sh index 2804f847d4..e02786fa86 100755 --- a/script/maven_overlay.sh +++ b/script/maven_overlay.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -19,7 +19,7 @@ location=$(dirname $0) rootdir=$(realpath ${location}/../) if [ "$#" -lt 2 ]; then - echo "usage: $0 []" + echo "usage: $0 [] []" exit 1 fi @@ -30,7 +30,45 @@ fi runtime_version=$1 output_dir=$2 -local_runtime_dir=${3:-} +staging_repo=${3:-} +local_runtime_dir=${4:-} + +if [ -n "$staging_repo" ]; then + if [[ $staging_repo == http:* ]] || [[ $staging_repo == https:* ]]; then + options="${options} -s ${rootdir}/settings.xml" + cat << EOF > ${rootdir}/settings.xml + + + + camel-k-staging + + + camel-k-staging-releases + Camel K Staging + ${staging_repo} + + true + never + + + false + + + + + + + camel-k-staging + + +EOF + else + local_runtime_dir="${staging_repo}" + staging_repo="" + fi +fi + if [ -z "$local_runtime_dir" ]; then mvn -q \ @@ -39,31 +77,34 @@ if [ -z "$local_runtime_dir" ]; then -Dartifact=org.apache.camel.k:camel-k-maven-logging:${runtime_version}:zip \ -DoutputDirectory=${rootdir}/${output_dir} - mv ${rootdir}/${output_dir}/camel-k-maven-logging-${runtime_version}.zip ${rootdir}/${output_dir}/camel-k-maven-logging.zip + mv ${rootdir}/${output_dir}/camel-k-maven-logging-${runtime_version}.zip ${rootdir}/${output_dir}/camel-k-maven-logging.zip else - # Take the dependencies from a local development environment - camel_k_runtime_source=$3 - camel_k_runtime_source_version=$(mvn -f $camel_k_runtime_source/pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout) - - if [ "$runtime_version" != "$camel_k_runtime_source_version" ]; then - echo "WARNING! You're building Camel K project using $runtime_version but trying to bundle dependencies from local Camel K runtime $camel_k_runtime_source_version" - fi - - mvn -q \ - $options \ - -am \ - -f $camel_k_runtime_source/support/camel-k-maven-logging/pom.xml \ - install - - mvn -q \ - $options \ - dependency:copy \ - -Dartifact=org.apache.camel.k:camel-k-maven-logging:$camel_k_runtime_source_version:zip \ - -DoutputDirectory=${rootdir}/${output_dir} - - mv ${rootdir}/${output_dir}/camel-k-maven-logging-$camel_k_runtime_source_version.zip ${rootdir}/${output_dir}/camel-k-maven-logging.zip + # Take the dependencies from a local development environment + camel_k_runtime_source_version=$(mvn -f $local_runtime_dir/pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout) + + if [ "$runtime_version" != "$camel_k_runtime_source_version" ]; then + echo "WARNING! You're building Camel K project using $runtime_version but trying to bundle dependencies from local Camel K runtime $camel_k_runtime_source_version" + fi + + mvn -q \ + $options \ + -am \ + -f $local_runtime_dir/support/camel-k-maven-logging/pom.xml \ + install + + mvn -q \ + $options \ + dependency:copy \ + -Dartifact=org.apache.camel.k:camel-k-maven-logging:$camel_k_runtime_source_version:zip \ + -DoutputDirectory=${rootdir}/${output_dir} + + mv ${rootdir}/${output_dir}/camel-k-maven-logging-$camel_k_runtime_source_version.zip ${rootdir}/${output_dir}/camel-k-maven-logging.zip fi unzip -q -o ${rootdir}/${output_dir}/camel-k-maven-logging.zip -d ${rootdir}/${output_dir} +if [ -n "$staging_repo" ]; then + rm ${rootdir}/settings.xml +fi + rm ${rootdir}/${output_dir}/camel-k-maven-logging.zip