Wednesday, September 7, 2011

Maven - My Own Cheat-Sheet

  • How maven finds the parent pom.xml:
    • by groupId/artifactId/version in the repo (local and then internal etc)
    • by parentsRelativePath if the tag is present
    • if both found, in some order, unknown to me.
  • To do a release: use release plugin which, among others:
    • verifies that not SNAPSHOT dependencies are used
    • cuts of the "-SNAPSHOT" and builds the project
    • tags the corresponding version
    • bumps up the version number and commits the version with "-SNAPSHOT" on the Head of the SVN/CVS
  • Dependency scope:
    • compile - makes the dependency available to dependent projects, will be placed to all classpaths (compile, testing, runtime), it's default scope
  • What are possible values for dependency versions:
    • 1.0.7 - is satisfied by 1.0.7 only and once installed in local repository, it never checks again if a newer or different version 1.0.7 is available
    • 1.0.7-SNAPSHOT - is satisfied by 1.0.7-SNAPSHOT only, but every so often it checks if a newer (or different) 1.0.7-SNAPSHOT is available
    • RELEASE - is satisfied by the highest release version available
    • none (tag skipped) - inherits the version from dependency defined in parent's pluginManagement tag.