Maven Snippets

Deploying a jar file to your artifact repository server

mvn deploy:deploy-file -Dfile=antlr-3.0.1.jar  
-DgroupId=org.antlr -DartifactId=antlr3 -Dversion=3.0.1 
-Dpackaging=jar -DrepositoryId=xerial 
-Durl=scp://www.xerial.org/(REPOSITORY_DIR)/maven/artifact

Releasing Jar (with taking the snapshot of the release)

 > mvn release:prepare
 > mvn release:perform

Include JAR References within Ant Script

<project>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>my-test-app</artifactId>
  <groupId>my-test-group</groupId>
  <version>1.0-SNAPSHOT</version>

  <build>
    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>compile</id>
            <phase>compile</phase>
            <configuration>
              <tasks>
                <property name="compile_classpath" refid="maven.compile.classpath"/>
                <property name="runtime_classpath" refid="maven.runtime.classpath"/>
                <property name="test_classpath" refid="maven.test.classpath"/>
                <property name="plugin_classpath" refid="maven.plugin.classpath"/>

                <ant antfile="${basedir}/build.xml">
                  <target name="test"/>
                </ant>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

Activate Profiles

  mvn -P (profile_name) ...

Setting OS specific properties via profiles

  <properties>
    <gwt.jvmargs></gwt.jvmargs>
  </properties>

  <!--  OS dependent settings for GWT compiler -->
  <profiles>
    <profile>
      <id>windows</id>
      <activation>
        <os>
          <family>windows</family>
        </os>
      </activation>
      <properties>
        <swt.os-specific-dep>swt-win32</swt.os-specific-dep>
        <gwt.dev>gwt-dev-windows</gwt.dev>
        <gwt.version>1.4.60</gwt.version>
      </properties>
    </profile>
    <profile>
      <id>unix</id>
      <activation>
        <os>
          <family>unix</family>
        </os>
      </activation>
      <properties>
        <swt.os-specific-dep>swt-linux-gtk-x86</swt.os-specific-dep>
        <gwt.dev>gwt-dev-linux</gwt.dev>
        <gwt.version>1.4.60</gwt.version>
      </properties>
    </profile>
    <profile>
      <id>mac</id>
      <activation>
        <os>
          <family>mac</family>
        </os>
      </activation>
      <properties>
        <swt.os-specific-dep>swt-carbon-macosx</swt.os-specific-dep>
        <gwt.dev>gwt-dev-mac</gwt.dev>
        <gwt.version>1.4.60</gwt.version>
        <gwt.jvmargs>-XstartOnFirstThread</gwt.jvmargs>
      </properties>
    </profile>
  </profiles>