Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Maven - useful tips and tricks

Hello,

Here are some commands and settings which you may find useful when working with Maven.


  • Installing third party JAR artifacts into the local repository

mvn install:install-file -Dfile=<path_to_jar> -DgroupId=<groupid> -DartifactId=<artifactid> -Dversion=<version> -Dpackaging=<packaging>

  • Running build in the offline mode: mvn clean install -o
  • Copy all project dependencies to the folder target/dependencies:
mvn dependency:copy-dependencies

Note: you may actually only be interested in the 'runtime' dependencies:
mvn dependency:copy-dependencies -DincludeScope=runtime

  • Delete / purge the existing dependencies and download again:
mvn dependency:purge-local-repository

  • Check for newer versions of project dependencies and plugins:

mvn versions:display-dependency-updates
mvn versions:display-plugin-updates

  • Skipping unit test from the build: mvn clean install -DskipTests=true

Note: you can make it permanent in the POM file configuration:
<properties>
  <skip.tests>true</skip.tests>
</properties>

<build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.18.1</version>
        <configuration>
          <skipTests>${skip.tests}</skipTests>
        </configuration>
      </plugin>
    </plugins>

</build>


For more info and guides please visit the official webiste: https://maven.apache.org/




This post first appeared on IT Code Hub - Java, Mobile Apps, Linux And More, please read the originial post: here

Share the post

Maven - useful tips and tricks

×

Subscribe to It Code Hub - Java, Mobile Apps, Linux And More

Get updates delivered right to your inbox!

Thank you for your subscription

×