krypted.com

Tiny Deathstars of Foulness

Maven can be as simple or as complicated as you’d like. The maven command line interface is mvn. You can quickly find the version using the –version option:

mvn –version

This is useful for a lot, but most notably to see where Maven is, which is in the home line. You can then create a project by using the archetype:generate option. Let’s say I wanted to create an artifactID of Precache with a standard environment (DarchetypeArtifactId) that doesn’t need to be interactive. That would look as follows using the mvn command:

mvn archetype:generate DgroupId=com.precache DartifactId=precache DarchetypeArtifactId=mavenarchetypequickstart DinteractiveMode=false

This creates a directory in Maven with a full hierarchy that matches what maven will need (a faux root) for each app created. The pom.xml file is created in the root of the faux root and outlines metadata for the project as well as dependencies. Next, copy any source code into ../src/main/java (where .. is the faux root of the maven project) and any source test code into ../src/test/java. 

Once the files are where they need to be it’s as easy as running mvn with the package verb to package it all up:

mvn package

That creates the jar file. Next, create a site:

mvn site

And between steps, do a little housekeeping:

mvn clean dependency
:copydependencies package

Run your unit tests with the test verb (super-hard to remember):

mvn test 

And check to see if your test sources compile use the test-compile verb:

mvn test-compile

October 7th, 2017

Posted In: Java

Tags: , , ,

Leave a Comment

To use the command line to install a package, use the following command: installer -pkg ./<package name> -target/

July 14th, 2007

Posted In: Mac OS X, Mac OS X Server

Tags: , , , ,