Last active
February 25, 2019 13:10
-
-
Save ouyi/7c64b7a9b83014b714a440be302504c6 to your computer and use it in GitHub Desktop.
Frequently used Maven commands
This file contains 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
# --- Maven --- | |
# Skip test execution | |
mvn package -DskipTests | |
# Skip test compilation | |
mvn package -Dmaven.test.skip=true | |
# Retrieve the project version | |
mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec | |
mvn org.apache.maven.plugins:maven-help-plugin:evaluate -Dexpression=project.version | grep -v '^\[' | |
# Dependency tree | |
mvn dependency:tree | grep -E 'commons.*fileupload' | |
# Set up mvnw | |
mvn -N io.takari:maven:wrapper | |
# Force a particular maven version: | |
mvn -N io.takari:maven:wrapper -Dmaven=3.5.4 | |
# Add the new files to Git: | |
git add .mvn/ mvnw* | |
git commit -m "Add mvnw" | |
# Count artifactory packages matching given path and naming patterns | |
REMOTE_PACKAGE_COUNT=$(curl -s "https://${ARTIFACTORY}/artifactory/api/search/artifact?name=${PACKAGE_FILENAME}&repos=${ARTIFACTORY_ROOT}" | jq ".results | map(select(.uri | test(\"${ARTIFACTORY_PATH}.*${PACKAGE_FILENAME}\"))) | length") | |
if [ "$REMOTE_PACKAGE_COUNT" -ne 0 ]; then | |
echo "Package already exits at target path" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment