Wednesday, May 1, 2013

Maven Tips and Tricks

-Download all your dependencies to target/dependencies:
mvn dependency:copy-dependencies
-But note, you probably only want the dependencies that you actually need at runtime:
mvn dependency:copy-dependencies -DincludeScope=runtime
-Check all of your dependencies to see if newer versions are available (versions plugin):
mvn versions:display-dependency-updates
-And do the same for your plugins:
mvn versions:display-plugin-updates
-Purge all the project’s dependencies and re-download (dependency plugin):
mvn dependency:purge-local-repository
-Build a package but skip running the tests:
mvn package -DskipTests
-If Maven caches a failure to find a dependency, but you’ve fixed it, add a -U to your command line.
In a multi-module project, you need to build from the root pom to find dependencies.
If you just want to build a specific module/project
(Note that I’m just specifying it using the artifactId and you need to include a colon in front):
mvn package -pl :artifactId
-Maven Installing Jar in Local Repo.
mvn install:install-file -Dfile=
mvn install:install-file -Dfile= -DpomFile=
mvn install:install-file -DgroupId=org.springframework.roo -DartifactId=org.springframework.roo.osgi.bundle -Dversion=1.2.4.RELEASE

No comments:

Post a Comment