Some maven thoughts

Some random observations about using maven

Checking dependencies

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

Release

With github

Use at least mvn 3.0.4 and release plugin 2.3.2 otherwise it hangs/takes a long time to return apparently after doing git push (it may still work)

When you want to release but don’t want to deploy to a repo

One shot


mvn -o release:prepare -DpreparationGoals='clean install -Dmaven.test.skip=true' -Dresume=false -DautoVersionSubmodules=true

Two shot

mvn release:prepare as normal

mvn release:perform -Dgoals=install

Working with a repository

1) In .m2/settings.xml

 <settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<servers>
   <server>
      <id>myrepo-read</id>
      <username>mavenuser</username>
      <password>mavenpass</password>
   </server>

<!-- for deployment -->
 <server>
    <id>myrepo</id>
    <username>user</username>
    <privateKey>/home/user/.ssh/id_rsa</privateKey>
    <passphrase>mypassphrase</passphrase>
    <directoryPermissions>775</directoryPermissions>
    <filePermissions>664</filePermissions>
 </server>
</servers>

<profiles>

    <profile>
      <id>myrepo</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <repositories>
        <repository>
          <id>myrepo-read</id>
          <url>https://maven.mydomain.org/</url>
        </repository>
      </repositories>
    </profile>
  </profiles>

</settings>