I came across a situation today where Maven threw an OutOfMemoryException
. I didn’t think the process would have taken that much memory but it clearly did. I was trying to deploy. I then tried it again but skipped the tests. No good. I found out that by setting the MAVEN_OPTS
environment variable to something like -Xmx512m
I was good to go.
maven
Maven Commands
I've collected a short list of commands I use for maven and thought I'd share. Install to Local Repository Compile Test Classes, Do Not Run Tests
mvn -Dmaven.test.skip.exec installInstall to Local Repository Do Not Compile Test Classes, Do Not Run Tests
mvn -Dmaven.test.skip installGenerate Test Results in HTML Format (tests will be run)
mvn surefire-report:reportGenerate Test Results in HTML Format (tests will not be run, source of reports will be last tests run)
mvn surefire-report:report-onlyRun Specific Test Class
mvn -Dtest=MyTestClass testUse Patterns to Run Specific Tests
mvn -Dtest=MyTest*lass testRun Multiple Specific Test Classes
mvn -Dtest=UnitTestClass,Accep*TestClass testView Dependency Tree: output is a mono-spaced tree views of all classes in the current artifact
mvn dependency:treeDownload Sources: Usually when using Maven only the binary version of your dependency are fetched from the repository. This will tell Maven to download the sources of your dependencies.
mvn [goal] -DdownloadSources=trueDownload JavaDocs: Same as with sources, Maven doesn't usually grab the JavaDocs.
mvn [goal] -DdownloadJavadocs=true
0 Comments