Created
April 10, 2026 22:01
-
-
Save favila/e4644c250ff5f19c0834cea7418232c3 to your computer and use it in GitHub Desktop.
mvn-copy: copy a pom and jar to a local repo easily
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| if [[ $# -eq 1 ]]; then | |
| pom="${1}.pom" | |
| jar="${1}.jar" | |
| elif [[ $# -eq 2 ]]; then | |
| pom="$1" | |
| jar="$2" | |
| else | |
| echo "Usage: mvn-copy <prefix> | mvn-copy <pom> <jar>" >&2 | |
| exit 1 | |
| fi | |
| if [[ ! -f "$pom" ]]; then | |
| echo "Error: pom file not found: $pom" >&2 | |
| exit 1 | |
| fi | |
| if [[ ! -f "$jar" ]]; then | |
| echo "Error: jar file not found: $jar" >&2 | |
| exit 1 | |
| fi | |
| mvn install:install-file -q -Dfile="$jar" -DpomFile="$pom" | |
| echo '${project.groupId}/${project.artifactId} "${project.version}"' \ | |
| | mvn help:evaluate -q -DforceStdout -f "$pom" | |
| echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment