<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>let x=x &#187; maven</title>
	<atom:link href="http://www.crazymcphee.net/x/tag/maven/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.crazymcphee.net/x</link>
	<description>programming idiom and methodology</description>
	<lastBuildDate>Tue, 13 Jul 2010 21:56:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Money-is-Money v0.16</title>
		<link>http://www.crazymcphee.net/x/2009/04/17/money-is-money-v016/</link>
		<comments>http://www.crazymcphee.net/x/2009/04/17/money-is-money-v016/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 13:56:59 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[money]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=327</guid>
		<description><![CDATA[Putting money-is-money into my own Maven repository gave the impetus to me to clean up the actual code base of the library. There are now a grand total of three classes, including an interface, which is much reduced. As anyone who knows me, will know that I think this is a great improvement. See this [...]]]></description>
			<content:encoded><![CDATA[<p>Putting money-is-money into my own <a title="v0.15 with maven repository" href="http://www.crazymcphee.net/x/2009/04/17/money-is-money-v015-with-added-maven-repository/" target="_self">Maven repository</a> gave the impetus to me to clean up the actual code base of the library. There are now a grand total of <em>three</em> classes, including an interface, which is <em>much</em> reduced. As anyone who knows me, will know that I think this is a great improvement. See <a href="http://www.crazymcphee.net/x/2009/04/17/money-is-money-v015-with-added-maven-repository/" target="_self">this post </a>- also linked in the first sentence above &#8211; to learn the details of the Maven repository and how and where to get the source code check out.</p>
<p>You can manually browse the artefacts in the repository <a href="http://modular.autonomous.org/artifactory-2.0.5/libs-releases-local/org/autonomous/money-is-money/0.16/">here</a>.</p>
<p>Here&#8217;s the updated README:</p>
<blockquote><p>This package is copyright 2008-2009 Scot Mcphee.</p>
<p>Email: scot.mcphee at gmail.com</p>
<p>Licence is the M.I.T. Licence. Please see the file &#8220;LICENCE&#8221;.</p>
<p>WHAT IS Money-Is-Money?</p>
<p>Money-Is-Money is a library for the correct manipulation of monetary data. I wrote this small library because I found that there were not any available public source Money implementations, despite some Time-based libraries promising such (I guess Time is more interesting to programmers than filthy lucre).</p>
<p>It consists primarily of an interface, called &#8216;Money&#8217;, and a Factory for making money, called &#8216;MoneyMaker&#8217;. There is a single implementation classes, MoneyAmount.</p>
<p>Money uses BigDecimal throughout to represent values. Yes, that&#8217;s a java.math.BigDecimal. If you whine about wanting to use doubles and floats congratulations! You are the target audience and therefore you should *really* be using this library and I won&#8217;t go into debate here why it&#8217;s wrong to use floating point logic in  Money implementations.</p>
<p>Money is designed to be an immutable object. All operations on Money, such as Money.add(Money) returns a new instance of Money representing the added amounts. There are operations for add, subtract, divide, and multiply. The default rounding mode is HALF_EVEN or &#8216;bankers rounding&#8217;. If a value comes out to 0.5, it is rounded to the EVEN value, so $3.555 at  a precision of 2 decimal places becomes 3.56, and so does $3.565. Divide and multiply also include methods to perform those operations with a user-specified rounding mode. There are also methods to do high-precision &#8220;no rounding&#8221; division and multiplication (dividePrecise and multiplyPrecise), which will throw an ArithmeticException if the decimals cannot be terminated and therefore have no decimal representation, e.g. 10/3, so be careful in using it.</p>
<p>There is also two methods to &#8216;proRate&#8217; money. The first takes the existing money and divides it up as equally as possible into the number of buckets you specify, with the modulo distributed in as small as increments as possible across as many of the buckets as possible.</p>
<p>This is NOT THE SAME as dividing by the number you specify. So $10.00 divided into 3 buckets results in buckets containing $3.34, $3.33, $3.33. The specification is that adding the buckets back up should always result in the original amount without any rounding errors. You should be able to pro rate an amount, then pro rate those amounts, recursively many many times and adding up all the &#8216;leaf&#8217; values will result in EXACTLY the original amount.</p>
<p>There is an additional method of &#8216;proRate&#8217;. That is the weighted pro-rate, proRateWeighted. It allows you divide a money amount into a number of buckets with each amount weighted according to a value in an array. E.g. an array of {1, 2} divides the amount into 2 buckets, the first one having 1/3 of the amount, the second 2/3. This can get much more complex than that simple example, e.g. consider $54 divided by the weights {1, 1, 2, 3, 5, 8, 13, 21}. Well in that case I am cheating because the amounts returned would be {1, 1, 2, 3, 5, 8, 13, 21}, but consider some random amount, let&#8217;s say  $9824516.53 divided by that same array of weightings. The weightings have to be obeyed and the numbers  must all add up at the end. This implementation was supplied by my friend and former colleague Tim Eagles and refined a little by myself.</p>
<p>The current implementations of both the &#8216;proRate&#8217; methods take the remainder <em>R</em> and distribute it amongst the *first* <em>R</em> elements of the (weighted or un-weighted) buckets. Thus, the earliest elements may be out by 1 cent (or 1 whole Yen) compared to a straight floating point division of value divided by number of buckets.</p>
<p>If you find this library at all useful, or have improvements and suggestions, drop me a line at scot.mcphee@gmail.com</p>
<p>Please remember to shake your MoneyMaker.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/04/17/money-is-money-v016/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Money-Is-Money v0.15 with added maven repository</title>
		<link>http://www.crazymcphee.net/x/2009/04/17/money-is-money-v015-with-added-maven-repository/</link>
		<comments>http://www.crazymcphee.net/x/2009/04/17/money-is-money-v015-with-added-maven-repository/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 06:54:17 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[tools and techniques]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[money]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=322</guid>
		<description><![CDATA[In the course of an assignment for a client I&#8217;ve been giving Artifactory a good going-over. Artifactory is a Maven repository and mirror and is pretty cool and easy to set up &#8211; just drop the WAR file into a running Tomcat instance. On my Mac I ran it under Tomcat 6.0.18 with Java 5, [...]]]></description>
			<content:encoded><![CDATA[<p>In the course of an assignment for a client I&#8217;ve been giving <a title="Artifactory website" href="http://www.jfrog.org/products.php" target="_blank">Artifactory</a> a good going-over. Artifactory is a Maven repository and mirror and is pretty cool and easy to set up &#8211; just drop the WAR file into a running Tomcat instance. On my Mac I ran it under Tomcat 6.0.18 with Java 5, and on my personal Linux box (Ubuntu) I ran it with Tomcat 5.5 and Java 6. All is pretty sweet and it is fairly trivial to get Maven set up to use it. It&#8217;s just a matter of overriding the &#8216;central&#8217; repository in your <em>~/.m2/settings.xml</em> to point to you new local copy &#8211; by default it mirrors several useful repositories as well as the default one. Adding security (such as public read-only access and username/password for deployment of artefacts) takes only a few minutes on top of that.</p>
<p>In the course of all this testing though I thought it best to use it in something like real anger with the Maven release plugin rather than my rather artificial usage scenario I was building up between my two development machines.</p>
<p>As a result of all that I&#8217;ve released a version of my Monetary library, money-is-money. The version is 0.15 and the Maven repository for it can be found at <a title="Maven respoitory" href="http://modular.autonomous.org:80/artifactory-2.0.5/libs-releases-local/">http://modular.autonomous.org:80/artifactory-2.0.5/libs-releases-local</a></p>
<p>If you want to check the source code out with SVN out the release is at <em>http://crazymcphee.net/svn/money/tags/money-is-money-0.15</em> and the latest trunk at <em>http://crazymcphee.net/svn/money/trunk</em> (which at the time of writing is the same as the release of course, except it generates 0.16-SNAPSHOT).</p>
<p>To include it into your Maven POM you&#8217;ll have to add my respository to a profile in your settings.xml:</p>
<pre class="code" lang="xml">&lt;repositories&gt;
  &lt;repository&gt;
    &lt;id&gt;crazy-mcphee&lt;/id&gt;
    &lt;url&gt;http://modular.autonomous.org:80/artifactory-2.0.5/libs-releases-local&lt;/url&gt;
    &lt;snapshots&gt;
      &lt;enabled&gt;false&lt;/enabled&gt;
    &lt;/snapshots&gt;
    &lt;releases&gt;
      &lt;enabled&gt;true&lt;/enabled&gt;
    &lt;/releases&gt;
  &lt;/repository&gt;
&lt;/repositories&gt;</pre>
<p>At which point you can include the dependency in your pom.xml for your project:</p>
<pre class="code" lang="xml">&lt;dependency&gt;
  &lt;groupId&gt;org.autonomous&lt;/groupId&gt;
  &lt;artifactId&gt;money-is-money&lt;/artifactId&gt;
  &lt;version&gt;0.15&lt;/version&gt;
&lt;/dependency&gt;</pre>
<p>After that Maven should fetch the artifact from my repository automatically for you. Money-Is-Money is deliberately designed to void any external dependencies on anything other than Java libs, except for JUnit which only matters if you want to build from source. For more information please see <a href="http://www.crazymcphee.net/x/2009/02/11/money-is-money/" target="_self">this post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/04/17/money-is-money-v015-with-added-maven-repository/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Making Maven work through a web proxy</title>
		<link>http://www.crazymcphee.net/x/2009/03/25/making-maven-work-through-a-web-proxy/</link>
		<comments>http://www.crazymcphee.net/x/2009/03/25/making-maven-work-through-a-web-proxy/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 06:13:20 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[tools and techniques]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=290</guid>
		<description><![CDATA[Client has a vicious network policy installed with prevents access to the rest of the world&#8217;s internet, unless you use the web proxy. How to make Maven use this proxy? Well, the documentation for Maven is perfectly easy to search, and you&#8217;ll find that it says to add the following to your ~/.m2/settings.xml: &#60;settings&#62; ... [...]]]></description>
			<content:encoded><![CDATA[<p>Client has a vicious network policy installed with prevents access to the rest of the world&#8217;s internet, unless you use the web proxy. How to make Maven use this proxy? Well, the documentation for Maven is perfectly easy to search, and you&#8217;ll find that it says to add the following to your ~/.m2/settings.xml:</p>
<pre>&lt;settings&gt;
...
    &lt;proxies&gt;
        &lt;proxy&gt;
            &lt;active&gt;true&lt;/active&gt;
            &lt;protocol&gt;http&lt;/protocol&gt;
            &lt;host&gt;proxy-server.example.com&lt;/host&gt;
            &lt;port&gt;8080&lt;/port&gt;
            &lt;nonProxyHosts/&gt;
        &lt;/proxy&gt;
    &lt;/proxies&gt;
...
&lt;/settings&gt;</pre>
<p>Now, that&#8217;s as great as far as it goes &#8211; it works. But the problem is I need to put this setup on my laptop. And I take the laptop home and work on the code-base there. So why doesn&#8217;t Maven allow the &lt;proxies&gt; tag to appear inside the &lt;profile&gt; tag? It&#8217;s really annoying that I have to edit the &#8216;active&#8217; tag back and forth depending what site I&#8217;m currently connected at! Much easier to use a &#8216;-P client1&#8242; argument on the command line to active the proxy network setting for the &#8216;client1&#8242; location.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/03/25/making-maven-work-through-a-web-proxy/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Upgrading to Maven 2.1.0 on Macintosh OS X</title>
		<link>http://www.crazymcphee.net/x/2009/03/23/upgrading-to-maven-210-on-macintosh-os-x/</link>
		<comments>http://www.crazymcphee.net/x/2009/03/23/upgrading-to-maven-210-on-macintosh-os-x/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 02:43:30 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[technical]]></category>
		<category><![CDATA[tools and techniques]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[macintosh]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=265</guid>
		<description><![CDATA[Recently I found a Maven plugin that wouldn&#8217;t run under Maven version 2.0.6, and I had to upgrade it on my Macintosh. I quickly discovered the usual *nix upgrade (unpack, then update ${PATH}) didn&#8217;t seem to work, as the Macintosh OS X 10.5 comes with Maven pre-installed in /usr/share/ directory. Tip &#8211; I found where [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I found a Maven plugin that wouldn&#8217;t run under Maven version 2.0.6, and I had to upgrade it on my Macintosh. I quickly discovered the usual *nix upgrade (unpack, then update ${PATH}) didn&#8217;t seem to work, as the Macintosh OS X 10.5 comes with Maven pre-installed in /usr/share/ directory.</p>
<blockquote><p><strong><em>Tip</em></strong> &#8211; I found where it was installed with this simple series of *nix commands that should work on most Unix variants such as Linux, for anything on your ${PATH}, using the &#8216;which&#8217; command:</p>
<pre>CrazyMcphee:systems smcphee$ which mvn
/usr/bin/mvn
CrazyMcphee:systems smcphee$ ls -lrta /usr/bin/mvn
lrwxr-xr-x  1 root  wheel  24  9 Mar 22:50 /usr/bin/mvn -&gt; \
  /usr/share/maven/bin/mvn</pre>
</blockquote>
<p>Following the information on <a href="http://www.gridshore.nl/2008/01/28/upgrading-maven-on-the-mac/">this page</a> as a template, here&#8217;s the procedure I used to upgrade to the latest version at time of writing, Maven 2.1.0:</p>
<pre>CrazyMcphee:~ smcphee$ sudo su -
Password:
CrazyMcphee:~ root# cd /usr/share/
CrazyMcphee:share root# mv maven maven-2.0.6
CrazyMcphee:share root# cp -R \
/Users/smcphee/Development/systems/apache-maven-2.1.0/ \
maven-2.1.0
CrazyMcphee:share root# ln -s maven-2.1.0/ maven
CrazyMcphee:share root# exit
logout
CrazyMcphee:~ smcphee$ mvn -version
Apache Maven 2.1.0 (r755702; 2009-03-19 05:10:27+1000)
Java version: 1.5.0_16
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
Default locale: en_AU, platform encoding: MacRoman
OS name: "mac os x" version: "10.5.6" arch: "i386" Family: "unix"</pre>
<p>You&#8217;ll note I used a symlink for the &#8216;maven&#8217; directory to the &#8216;maven-2.1.0&#8242; directory (the command &#8216;ln -s maven-2.1.0/ maven&#8217; &#8230;). This is to allow me to quickly switch back to version 2.0.6 if I find any incompatibilities in my old POM files with the new version of Maven, by simply changing which directory the symlink points to.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/03/23/upgrading-to-maven-210-on-macintosh-os-x/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
