User Tools

Site Tools


maven:commands

Set Java version source and target

<project>
  [...]
  <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>
  [...]
</project>

Run a single test class

mvn -Dtest=TestCircle test

Run a single test method

mvn -Dtest=TestCircle#mytest test

Execute a Java class

mvn exec:java -Dexec.mainClass="ro.medjava.RenameDuplicates"

Remote debug unit (surefire plugin) tests

mvn -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent 
-Djava.compiler=NONE" test

Remote debug integration (failsafe plugin) tests

mvn -Dmaven.failsafe.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent 
-Djava.compiler=NONE" test  

Remote debug single integration (failsafe plugin) test

mvn -o verify -Dit.test=DataflowDeploymenFTPIT#testDeploySimpleFlowWithSTRelayAndFtpWithPassword 
-Dmaven.failsafe.debug

Remote debug integration (failsafe plugin) tests on default 5005 port

mvn -Dmaven.failsafe.debug verify

Use specified settings file

mvn --settings D:/Pro/MJ_MVN_Settings/settings.xml clean install -DskipTests

Specify local repository

mvn clean install -DskipTests -Dmaven.repo.local=D:/MavenRepo

Deploy to local repository

mvn --settings D:/Pro/MJ_MVN_Settings/settings.xml deploy -DskipTests -Dmaven.repo.local=D:/MavenRepo

Deploy to default repository

mvn deploy

Deploy to default repository with sources and java doc

mvn clean javadoc:jar source:jar deploy

Deploy third party jar in remote repository

mvn deploy:deploy-file -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=12.2.0.1.0 -Dpackaging=jar 
-Dfile=ojdbc8.jar -DgeneratePom=true -DrepositoryId=internal -Durl=https://medjava.ro/archiva/repository/internal

Get dependency tree

mvn dependency:tree

Show full pom

mvn help:effective-pom -Doutput=full.txt

Remote debug single test class

mvn -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent 
-Djava.compiler=NONE" -Dtest=TestTrkPrint test

Download sources

mvn dependency:sources

Download java doc

mvn dependency:resolve -Dclassifier=javadoc

Force update snapshots dependencies

mvn -U clean install

Force update all dependencies

mvn dependency:purge-local-repository clean install

Deactivate (exclude) a profile from command line

mvn clean install -P !sign
maven/commands.txt · Last modified: 2023/07/04 19:36 by 127.0.0.1