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

Rarely, but Happily!

March 2nd, 2016

Posted In: Mac OS X, Mac Security, Mass Deployment

Tags: , ,

The wget command is used to download files from the web and is one of the most useful commands around. But while it comes included with most distributions of Linux, it is not built into Mac OS X by default. Therefore, let’s look at installing wget. To get started, install the developer tools for Mac OS X so that you can get a working copy of a compiler (gcc). Once the developer tools have been installed, you’ll want to download the latest version of wget from gnu. To do so, either download it manually from http://www.gnu.org/software/wget or use the ftp command to do so for you:
ftp ftp://ftp.gnu.org/gnu/wget/wget-latest.tar.gz
Next, extract the tar file using the tar command:
tar -xvzf wget-latest.tar.gz
You will then have a directory called wget- followed by the version of wget you just downloaded (currently 1.12). Let’s cd into that directory:
cd wget-1.12
Then run the configure script:
./configure
Then make the installer:
make
Then run the installer (with elevated privileges:
make install
You will then have the wget command located in /usr/local/bin/wget. To use it, simply use wget, followed by the path to the file you’d like to download using the –tries option:
wget –tries=10 http://www.krypted.com/scripts/wget.sh
There are a lot of options for wget, but some that I use more than others include –user= and –password=, which allows you to authenticate to a host by specifying a username and a password (respectively of course) and –limit-rate, which funny enough, let’s you throttle the speeds of transfers so as not to saturate your bandwidth. I also frequently need to use the -r operator, which allows for recursive downloads and the -o operator which outputs to a log file. Overall wget is one of the most useful commands around, and hopefully after reading this you’ll download it and get used to using it (if you weren’t already).

November 29th, 2010

Posted In: Mac OS X

Tags: , , , , , , , ,