Skip to content

Instantly share code, notes, and snippets.

@justin-lyon
Created March 6, 2021 02:49
Show Gist options
  • Save justin-lyon/5d7d48fc7c9a034f43bae0446f27235a to your computer and use it in GitHub Desktop.
Save justin-lyon/5d7d48fc7c9a034f43bae0446f27235a to your computer and use it in GitHub Desktop.
Java Build Commands
# These are some Java and Maven commands I want to keep handy
# Create a clean package, wipes out /target, compiles, runs tests, and generates a brand new .jar
mvn clean package
# Run the jar
java -jar target/myapp.jar
# List the contents of the jar
jar tf target/myapp.jar
# Extract from jar to cwd
jar xf path/to/myapp.jar
# Extract one file (META-INF/MANIFEST.MF) from jar to cwd
jar xf path/to/myapp.jar META-INF/MANIFEST.MF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment