A Few Maven Tips



Decided to write some useful things, which often helps in everyday life to Maven user, like me:

  1. The command line argument -o said to Maven to work in offline mode and this sometimes saves time. In this case, maven is lookіng for all the libraries and plugins in the local repository and do not even tries to ping central repositories for update. Also useful with slow and unstable Internet connection.

  2. Property maven.test.skip helps to perform project compilation without running test cases. Could be useful when the environment is not yet ready for testing or all tests green. Run command in next format: mvn install -Dmaven.test.skip=true.

  3. File MVN_HOME/conf/settings.xml contains a number of useful settings. One of them is localRepository, through which you can specify the repository somewhere on the disk D: etc. Windows users oftenly format drive C: and rarely backups local Maven repository. Correct value for this setting can save a lot of time after re-installing windows next time.

  4. If you are using Maven plugin to generate Javadoc for a project with multiple modules, it can be very useful to perform the aggregation of generated documentation. In this case use property aggregate, for example:

    <plugin>
      <artifactId>maven-javadoc-plugin>/artifactId>
       <configuration>
        <aggregate>true</aggregate>
       </configuration>
    </plugin>


The list is not complete, it will expand as soon as I remember or find new tips.

No comments: