niedziela, 13 grudnia 2015

How to deploy chosen artifacts of multimodule maven application

In case there is parent module you need to install also this parent pom.
  REPO_ID=myRepoIdDefinedInSettingsXml && \
  REPO_URL=http://example.com/nexus/content/repositories/releases && \
  VERSION=2.3.1 && \
  /usr/local/bin/mvn deploy:deploy-file \
     -DgroupId=${GROUP_ID} \
     -DartifactId=${PARENT_ARTIFACT_ID} \
     -Dpackaging=pom \
     -Dversion=${VERSION} \
     -DrepositoryId=${REPO_ID} \
     -Durl=${REPO_URL} \
     -Dfile=build/release-*/pom.xml && \
Once parent module is installed (but in fact doesn't need to be first) we can install our modules (MODULE1, MODULE4 and MODULE_N). Installing sources is optional (if your package phase does not generate source bundle - just skip -Dsource option.
for ARTIFACTID in MODULE1 MODULE4 MODULE_N; do \
    for FILE in $(find target/${ARTIFACTID} -name "${ARTIFACTID}*.jar" | grep -v sources); do \
      /usr/local/bin/mvn deploy:deploy-file \
        -DgroupId=${GROUP_ID} \
        -DartifactId=${ARTIFACTID} \
        -Dversion=${VERSION} \
        -DpomFile=$(dirname ${FILE})/../pom.xml \
        -Dpackaging=jar \
        -DrepositoryId=${REPO} \
        -Durl=${REPO_URL} \
        -Dfile=$(dirname ${FILE})/${ARTIFACTID}-${VERSION}.jar \
        -Dsources=$(dirname ${FILE})/${ARTIFACTID}-${VERSION}-sources.jar; \
    done; \
  done; \

Brak komentarzy:

Prześlij komentarz