Maven (Apache)

Apache Maven is a plugin-based build automation tool, similar in purpose to GNU Make or Apache Ant. It is most commonly used with Java projects, but also supports other languages such as .NET and C/C++.

Availability & Compatibility

Version Glenn Oakley
3.0.4   X

Restrictions

There are no restrictions for this software; any OSC user may make use of the Apache Maven.

Usage

Set-up

To use Maven, load the the "maven" module with the following command.

module load maven

To test that the install worked correctly, run "mvn --version". You should see output similar to that shown below:

 

$ mvn --version
Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500)
Maven home: /usr/local/maven/3.0.4
Java version: 1.6.0_29, vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/java-1.6.0-sun-1.6.0.29.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-131.17.1.el6.x86_64", arch: "amd64", family: "unix"

 

Basic Usage

Once the module is loaded, you can use Maven just as you would on your local machine. For example, the session below illustrates initializing a new project call "my-app":

 

$ mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom >>>
[INFO] 
[INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom <<<
[INFO] 
[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Batch mode
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.mycompany.app
[INFO] Parameter: packageName, Value: com.mycompany.app
[INFO] Parameter: package, Value: com.mycompany.app
[INFO] Parameter: artifactId, Value: my-app
[INFO] Parameter: basedir, Value: /nfs/12/jmccance
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir: /nfs/12/jmccance/my-app
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.429s
[INFO] Finished at: Fri Jun 08 14:30:57 EDT 2012
[INFO] Final Memory: 9M/361M
[INFO] ------------------------------------------------------------------------

Further Reading

See Also

Supercomputer: 
Service: