Maven Useful Commands
Maven commands to quickly get you going.
cli ide
๐งฉ Manually Install a Dependency (Oracle, IBM, Internal JARs)#
Used when a dependency cannot be downloaded from Maven Central due to licensing or internal policy.
Command#
mvn install:install-file \
-Dfile=ojdbc8.jar \
-DgroupId=com.oracle.database.jdbc \
-DartifactId=ojdbc8 \
-Dversion=19.3.0.0 \
-Dpackaging=jarbashUse Cases#
- Oracle JDBC drivers
- Telecom / vendor SDKs
- Internal utilities not published yet
๐ข Deploy a Local JAR to Nexus / Artifactory#
Publish any standalone JAR to your internal Maven repository.
Command#
mvn deploy:deploy-file \
-Durl=http://nexus.myorg.com/repository/maven-releases/ \
-DrepositoryId=nexus \
-Dfile=my-util.jar \
-DgroupId=com.myorg.util \
-DartifactId=my-util \
-Dversion=1.0.0 \
-Dpackaging=jarbash๐ Debug Dependency Conflicts#
View full tree#
mvn dependency:treebashFilter a specific dependency#
mvn dependency:tree -Dincludes=com.fasterxml.jackson.corebashVerbose mode#
mvn dependency:tree -Dverbosebash๐ Force Maven to Download Latest Dependencies#
mvn clean install -Ubash๐งฑ Build Only a Specific Module#
mvn -pl module-name -am clean installbash๐ซ Skip Tests (Execution or Compilation)#
Skip test execution#
mvn clean install -DskipTestsbashSkip both compilation & execution#
mvn clean install -Dmaven.test.skip=truebash๐งช Run Specific Tests#
Run a single test#
mvn -Dtest=LoginTest testbashRun by pattern#
mvn -Dtest=User*Test testbashRun a specific method#
mvn -Dtest=LoginTest#shouldLoginWorks testbash๐งน Fix Corrupted .m2 Dependencies#
Delete a specific library#
rm -rf ~/.m2/repository/com/oraclebashPurge entire local repo#
mvn dependency:purge-local-repositorybash๐ Generate Effective POM#
mvn help:effective-pombash๐ง List All Plugins Used in Build#
mvn help:effective-pom | grep pluginbash๐ Enable Debug Logging for CI/CD Issues#
mvn clean install -Xbash๐ Fix SSL Issues (PKIX Error)#
keytool -import -alias nexus \
-file nexus.crt \
-keystore $JAVA_HOME/jre/lib/security/cacertsbash๐งฉ Show Available Profiles#
List all profiles#
mvn help:all-profilesbashShow active profiles#
mvn help:active-profilesbash๐งต Build Using a Specific Profile#
mvn clean install -Pdevbash๐ฆ Download Dependencies for Offline Use#
mvn dependency:go-offlinebashRelated DevTools
Published: 12/5/2025
Back to DevTools