Stubbisms – Tony’s Weblog

August 10, 2008

WordPress – prevent smileys in code quotes

Filed under: General — Tags: , , , , — Antony Stubbs @ 4:49 am

I finally figured out how to prevent wordpress from replacing some of my source quotes with smiley faces.

WordPress appears to replace all “) with smileys, as after it’s parsed into html, ” get’s converted to &quote; which when a ” appears right before a ) works out to be ") (FYI

" ) - but without the space

) and if you look closely, there’s a little 😉 (

; ) - but without the space

) in there!

System.out.println("Hello world!") ;
println "addDependency(['${scope}'], \"${contructSignature(it)}\") {"

So, inserting a space between the ” and the ) stops it from triggering! Hurrah!

System.out.println( "Hello world!" );
println "addDependency(['${scope}'], \"${contructSignature(it)}\" ) {"

However, as you can see, if the ) is immediately followed by a ; then WordPress seems to leave the "); alone…

System.out.println("Hello world!");

I’ve Googled for this before and not found anything, so just thought I’d share the love!

Now to go back and fix some old posts… =D

Advertisements

July 30, 2008

git rebase, svn and whitespace

Filed under: Java — Tags: , , , , — Antony Stubbs @ 10:35 pm

Working behind a svn repository using the excellent git-svn tool and in a Windows environment, you inevitably run into the problem of trailing whitespace.

Depending on your goals, the first step is to disable the pre-commit hook that checks for it in .git/pre/hooks/pre-commit. easy.

I ran into another interesting whitespace problem when I was running the git-rebase command. Basically the first stage worked fine, but when git went to apply the generated patch it failed complaining about various:

error: NotificationService/launchConfigs/All JUnits.launch: does not match index

and

warning: squelched 104 whitespace errors
warning: 109 lines add whitespace errors.

and

error: Entry 'NotificationService/launchConfigs/All JUnits.launch' not uptodate. Cannot merge.

This is all very strange, because the patch should apply cleanly without any problem as there is no chance to modify any of these files during the process.

Short story was that after an initial panic, I thought back and remembered about the

core.whitespace

setting.

By running:

git-config core.whitespace=nowarn

You are telling git to ignore whitespace issues. I’m quite sure my problem was by git trying to fix them / translate them for during the rebase process.

If you look at

man git-apply

you can see one of the options is:

fix outputs warnings for a few such errors, and applies the patch after fixing
them (strip is a synonym --- the tool used to consider only trailing whitespaces as
errors, and the fix involved stripping them, but modern gits do more).

I believe this may have something to do with this bug in msysgit – “Problems patching for git rebase / git am”.

The work flow went like this:

stubbsa@VFNZV95336 /cygdrive/c/stubbs_dev_merge_git/oasis-cr
$ git rebase master
First, rewinding head to replay your work on top of it...
Applying added hibernate dep
.dotest/patch:15: trailing whitespace.

.dotest/patch:27: trailing whitespace.

.dotest/patch:28: trailing whitespace.
                        org.hibernate
.dotest/patch:29: trailing whitespace.
                        hibernate-annotations
.dotest/patch:30: trailing whitespace.
                        3.3.1.GA
warning: squelched 7 whitespace errors
warning: 12 lines add whitespace errors.
Applying Added hibernate dep, rev eng strategy, hibernate config for localhost and generation result.
.dotest/patch:24: trailing whitespace.

.dotest/patch:25: trailing whitespace.
                        org.hibernate.eclipse.console.hibernateBuilder
.dotest/patch:26: trailing whitespace.

.dotest/patch:27: trailing whitespace.

.dotest/patch:28: trailing whitespace.

warning: squelched 268 whitespace errors
warning: 273 lines add whitespace errors.
Applying Moved launch configurations.
.dotest/patch:26: trailing whitespace.

.dotest/patch:27: trailing whitespace.

.dotest/patch:28: trailing whitespace.

.dotest/patch:29: trailing whitespace.

.dotest/patch:30: trailing whitespace.

error: NotificationService/launchConfigs/All JUnits.launch: does not match index
error: NotificationService/launchConfigs/Dependency Tree.launch: does not match index
error: NotificationService/launchConfigs/Get Deps - runtime.launch: does not match index
Using index info to reconstruct a base tree...
:26: trailing whitespace.

:27: trailing whitespace.

:28: trailing whitespace.

:29: trailing whitespace.

:30: trailing whitespace.

warning: squelched 104 whitespace errors
warning: 109 lines add whitespace errors.
Falling back to patching base and 3-way merge...
error: Entry 'NotificationService/launchConfigs/All JUnits.launch' not uptodate. Cannot merge.
fatal: merging of trees 58e7f2e19e35fc8155e85f3238503f905e312053 and 1239e895b39ceab8e19b140cbf51f5ef7082201a failed
Failed to merge in the changes.
Patch failed at 0003.

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".

stubbsa@VFNZV95336 /cygdrive/c/stubbs_dev_merge_git/oasis-cr
$ git rebase --abort
HEAD is now at 5083609 Setup JPA using Hibernate

stubbsa@VFNZV95336 /cygdrive/c/stubbs_dev_merge_git/oasis-cr
$ git-config core.whitespace=nowarn

stubbsa@VFNZV95336 /cygdrive/c/stubbs_dev_merge_git/oasis-cr
$ git rebase -v master
Changes from cb70410d47e13640be9431d63373452a5e9d5c6e to 5548a15d3af44b8686c8e66b246128484a9feaef:
 NotificationService/lib/client-es-2.0.3.jar |  Bin 1939504 -> 0 bytes
 NotificationService/lib/client-es-2.0.5.jar |  Bin 0 -> 1998473 bytes
 2 files changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 NotificationService/lib/client-es-2.0.3.jar
 create mode 100755 NotificationService/lib/client-es-2.0.5.jar
First, rewinding head to replay your work on top of it...
Applying added hibernate dep
.dotest/patch:15: trailing whitespace.

.dotest/patch:27: trailing whitespace.

.dotest/patch:28: trailing whitespace.
                        org.hibernate
.dotest/patch:29: trailing whitespace.
                        hibernate-annotations
.dotest/patch:30: trailing whitespace.
                        3.3.1.GA
warning: squelched 7 whitespace errors
warning: 12 lines add whitespace errors.
Applying Added hibernate dep, rev eng strategy, hibernate config for localhost and generation result.
.dotest/patch:24: trailing whitespace.

.dotest/patch:25: trailing whitespace.
                        org.hibernate.eclipse.console.hibernateBuilder
.dotest/patch:26: trailing whitespace.

.dotest/patch:27: trailing whitespace.

.dotest/patch:28: trailing whitespace.

warning: squelched 268 whitespace errors
warning: 273 lines add whitespace errors.
Applying Moved launch configurations.
.dotest/patch:26: trailing whitespace.

.dotest/patch:27: trailing whitespace.

.dotest/patch:28: trailing whitespace.

.dotest/patch:29: trailing whitespace.

.dotest/patch:30: trailing whitespace.

warning: squelched 104 whitespace errors
warning: 109 lines add whitespace errors.
Applying Setup JPA using Hibernate
.dotest/patch:41: trailing whitespace.

.dotest/patch:44: trailing whitespace.

.dotest/patch:55: trailing whitespace.
                        org.eclipse.wst.common.project.facet.core.builder
.dotest/patch:56: trailing whitespace.

.dotest/patch:57: trailing whitespace.

warning: squelched 173 whitespace errors
warning: 178 lines add whitespace errors.

stubbsa@VFNZV95336 /cygdrive/c/stubbs_dev_merge_git/oasis-cr
$ gitk

As you can see, it still complains, but the rebase seems to have worked nicely.

There may be severe reprecusions of using core.whitespace=nowarn ( that’s a bit of a joke ) but I haven’t thought about it much yet. We’ll see… all that matters really in our case is that the svn dcommits get through looking sane.

July 29, 2008

A testimint to Proof (R.I.P) and Eminem’s talent

Filed under: Music — Tags: , , , , — Antony Stubbs @ 4:22 am

Proof’s death is so sad.

As you can see, this is documented proof of how well Eminem & Proof meshed when they freestyled together. I apologize to all Proof fans for depriving you of this classic video for so long. I actually ripped this from MTV.com many many years ago with an old realplayer video ripper called x-fileget, which doesn’t work anymore. R.I.P. Proof and much love and condolensces to his family and friends.”

July 27, 2008

It’s time to let go of Commons Logging – Long Live SLF4J!

Filed under: Java — Tags: , , , , , — Antony Stubbs @ 2:04 am

I support the complete abandonment of Commons Logging in favour of Simple Logging Facade 4 Java (SLF4J). Especially in libraries that use it – I think it’s amazing that Spring to link to it in their libraries!

For those of you that are blissfully un-aware of the hazards of the run time binding that commons logging uses and have been luckily enough not to have run into it yet – educate yourselves.

“Commons-logging promises to bridge to different logging APIs such as log4j, Avalon logkit and java.util.logging API. However, it’s dynamic discovery mechanism is the source of painful bugs.”

Apparently it’s his fault. Well mostly, as he admits:

“I’ll come right out and admit it: commons-logging, at least in its initial form, was my fault, though probably not mine alone.”

This guy deserves a medal. He freely hosts a great service for Maven users (yay! go Maven! (and Ivy and Gradle for that matter) ) that let’s you deal away with Commons Logging in your project easily.

The summary of the solution is basically:

<repositories>
    <repository>
        <id>Version99</id>
        <name>Version 99 Does Not Exist Maven repository</name>
        <layout>default</layout>
        <url>http://no-commons-logging.zapto.org/mvn2</url>
    </repository>
</repositories>
<dependencies>
    <!-- get empty jar instead of commons-logging -->
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>99.0-does-not-exist</version>
    </dependency>
</dependencies>

LogBack as mentioned in my previous post, along with SLF4J is a step into the recent present for logging technology (as opposed to living in pre-historic times of commons logging.

It’s really amaizing that something as seemingly simple as logging causes such a nightmare for so many people!

Update

Maven issue MNG-1977 will address this issue nicely by letting you globally exclude all commons-logging dependencies across all transitive dependencies in one statement.

Please so your neighbor-hood developer a favour, and vote for it 🙂

July 26, 2008

Google Guice – Injecting primitives in constructors

Filed under: Java — Tags: , , , , , , — Antony Stubbs @ 2:10 am

Guice‘s user guide could definitely do with some work. It’s ok in some parts but overall it leaves a lot “up to the imagination” if you know what I mean.

I’d been googling various combinations of the words of the title of this blog post, and the Guice forums but couldn’t find an example or explanation of what I was looking for. I really think the User Guide needs this example in there.

For one thing, they definitely need more usage examples.

For example, they do not clearly show how to inject primitives into an injected constructor! I couldn’t figure it out from reading the user guide, but finally after some very random Google link clicking, I found an example. This post is to help try and bring this example to the fore front for other people to see.

To do this, I have now discovered nearly by fluke:

bindConstant().annotatedWith(Names.named( "dogs  name" )).to("suki");

and then in your constructor for the Guice managed object where the String is to be injected:

@Inject
public HouseHoldPet ( @Named( "dogs name" ) String myDogsName);

Pretty easy really now that I see it. Didn’t really understand the information around the @Named annotation in the user guide, but after seeing this example, I can see how it works.

Of course as far as Guice vs Spring is concerned – you’re *still* left with the task of keeping the key names in sync.

Oh First Class Properties, how I miss thee!

</adam sandler>3 weeks later…</adam sandler>

De’ night time is de’ right time… De’ night time is de’ right time…

Of course, I could have read this from the user guide, a little closer:

// Bind Bar to an instance of Bar.
Bar bar = new Bar();
binder.bind(Bar.class).toInstance(bar);

But there I suppose I was reading too fast, and it wasn’t sooo obvious. Honest.

This of course means that the above, as long as your requirements are pretty basic as mine were, can be replaced with:

bind(Animals.class).toInstance(new HouseHoldPet("suki");

Which would allow me to still have the pet name managed by the module configuration but allow the class to be automatically injected into dependent classes.

The draw back to using this approach is that you’re basically using a singleton. You probably don’t want to do that.

Along with the user guide, the Java Doc for the Binder Interface which I have also just discovered, actually has some other good examples with good explanations. However, the user guide again does not direct you here.

And yes, the 3 weeks later is an Adam Sandler joke 🙂 – it was more like, ‘later that night’… 😉

Update…

I have come across a new blog by Dhanji R. Prasanna which I found in response to my post about this blog on the Guice forum.

One of his blog posts on his thoughts on closures for java, contained a very succinct example of the Provider Interface:

bind(Service.class).toProvider(new Provider<Service>() {
    public Service get() {
        return new ServiceImpl();
    }
});

Using this technique, I can avoid the hassle of building an annotation for my parameter injection:

bind(Animals.class).toProvider(new Provider<Animals>() {
    public Animals get() {
        return new HouseHoldPet( "suki" );
    }
});

Neato!

And if you have a class which doesn’t implement an Interface, as do I, you can still an in-line factory for said class which injects the primitive:

bind(HouseHoldPet.class).toProvider(new Provider<HouseHoldPet>() {
    public HouseHoldPet get() {
        return new HouseHoldPet( "suki" );
    }
});

Choice!

“suki” of course should be extracted to a local constant – something like DEFAULT_PET_NAME or some such.

July 15, 2008

Ladies and Gentlmen, may I introduce – Pendulum plus Old Snake

Filed under: Music — Tags: , , , , , , — Antony Stubbs @ 11:59 am

Finally some new music! My good friend from Norway introduced to me a band I had heard but didn’t know the name of – Pendulum. Nice happy hard hitting trancy beats.

Aside from that – the sound track to Metal Gear Solid 4 – Guns of the Patriots is great too! The best tune being, of course, Old Snake.

Scala LoveGame enspired Overview presentation

Filed under: Java, Scala — Tags: , — Antony Stubbs @ 2:38 am

These are the slides from the presentation I have been giving on Scala, enspired by the love game – as described in my previous post.

Unfortunatly I still don’t have any video of any of the presentations.

And for the sake of Google, here’s the text from the slide… (more…)

Some serious logging niceness – Logback with Eclipse plugin

Filed under: Java — Tags: , , , — Antony Stubbs @ 12:25 am

I’ve just stumbled upon a new logging framework called Logback – I’d seen it before, but this time, someone I respect was switching to it, and someone he respects wrote an article on it which sums it up pretty nicely.

I especially take notice of the console Eclipse plugin – that’s what has made me download, install and try it out. And so far – nice. Serious nice.

The killer feature of the console plugin being two:

  1. Go to the java class and line where any given logging request was issued by double-clicking on its output line.
  2. Change the output format dynamically whenever you chose to do so.

And just for fun…

Java

package org.tony.nathan.daniel.james;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ch.qos.logback.classic.util.LoggerStatusPrinter;

public class LogbackJavaTest {

	public static void main(String[] args) {

	    Logger log = LoggerFactory.getLogger(LogbackJavaTest.class);
	    log.debug( "Hello world." );
	    log.info( "interesting info" );
	    log.warn( "WARNING WILL ROBINSON!" );
	    log.error( "I'm sorry Dave..." );
	    try {
		throw new Exception("Holly crapo we're dying!" );
	    } catch (Exception e) {
		log.error( "Something bad happened", e);
	    }
	    LoggerStatusPrinter.printStatusInDefaultContext();

	}
]

Groovy

package org.tony.nathan.daniel.james

import org.slf4j.Logger
import org.slf4j.LoggerFactory

import ch.qos.logback.classic.util.LoggerStatusPrinter

class LogBackGroovyTest {
	static void main(args) {

	    Logger log = LoggerFactory.getLogger(LogBackGroovyTest.class)
	    log.debug "Hello world."
	    log.info "interesting info"
	    log.warn "WARNING WILL ROBINSON!"
	    log.error "I'm sorry Dave..."
	    try {
			throw new Exception("Holly crapo we're dying!" )
		} catch (Exception e) {
			log.error( "Something bad happened", e)
		}
	    LoggerStatusPrinter.printStatusInDefaultContext()

	}
}

Scala

package org.tony.nathan.daniel.james

import org.slf4j.{Logger,LoggerFactory}

import ch.qos.logback.classic.util.LoggerStatusPrinter

object LogBackScalaTest {

  val log = LoggerFactory getLogger(LogBackScalaTest getClass)
  log debug( "Hello world." )
  log info( "interesting info" )
  log warn( "WARNING WILL ROBINSON!" )
  log error( "I'm sorry Dave..." )
  try {
    throw new Exception( "Holly crapo we're dying!" )
  }
  catch {
    case e => log.error( "Something bad happened", e)
  }
  LoggerStatusPrinter printStatusInDefaultContext

}

July 11, 2008

Groovy converter from Maven to Gradle Dependencies [GRADLE-154]

Filed under: Java — Tags: , , — Antony Stubbs @ 11:03 am

I raised an issue on Gradle jira the other day – so I thought I would fix it.

It is a groovy script that takes a pom.xml in the current directory, reads the dependencies and outputs Gradle formatted dependencies.

The Jira issue is here:
http://jira.codehaus.org/browse/GRADLE-154

It’s a work in progress, but it’s looking pretty good so I thought I’d post it here. Groovy rocks btw!
(btw, I gave up trying to get wordpress to stop trying to insert smiley faces. if you want the actual code, go to the jira issue)

Basically it works in a few steps.

  1. First step is to read in the pom.xml file and get it’s text into a string – easy.
  2. Next is to use the Groovy XmlSlurper library to parse the text string and get a reference to the outer project element.
  3. Then we can use GPath to navigate the object hierarchy and retrieve the collection of dependency nodes.
  4. Then using Groovy Looping and mapping a Groovy Closure to each element, we collect together all the dependency nodes into corresponding collections depending on their scope value.
  5. Next we define some utility functions that I will go over soon.
  6. Then for each collection, one at a time, we take each element and call our print function.
  7. The print function then checks the exclusions node to see if it exists, if so it branches off, otherwise we call our simple print function.
  8. Both print functions use GStrings to construct the print statements.
  9. The complex print statement does one extra task which is iterate over each ‘exclusion’ node and print out the artifact id.
/*
 * Copyright 2007 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * This script takes the pom.xml in the current directory, reads the from it dependencies
 * and outputs Gradle formatted dependencies.
 *
 * It currently is quite simplistic and does not perform any checks on inherited
 * dependencies or retreive version numbers from variables deplared in the pom.
 *
 * @author Antony Stubbs <antony.stubbs@gmail.com>
 */

// debug - print out our current working directory
println "Working path:" + new File(".").getAbsolutePath()

// read in the pom.xml file and get it’s text into a string
pomContent = new File("pom.xml").text

// use the Groovy XmlSlurper library to parse the text string and get a reference to the outer project element.
def project = new XmlSlurper().parseText(pomContent)

// use GPath to navigate the object hierarchy and retrieve the collection of dependency nodes.
def dependencies = project.dependencies.dependency

def compileTimeScope = []
def runTimeScope = []
def testScope = []
def providedScope = []
def systemScope = []

// using Groovy Looping and mapping a Groovy Closure to each element, we collect together all
// the dependency nodes into corresponding collections depending on their scope value.
dependencies.each() {
    def scope = (elementHasText(it.scope)) ? it.scope : "compile"
    switch (scope) {
        case "compile":
            compileTimeScope.add(it)
            break
        case "test":
            testScope.add(it)
            break
        case "provided":
            providedScope.add(it)
            break
        case "runtime":
            runTimeScope.add(it)
            break
        case "system":
            systemScope.add(it)
            break
    }
}

/**
 * print function then checks the exclusions node to see if it exists, if
 * so it branches off, otherwise we call our simple print function
 */
def printGradleDep = {String scope, it ->
    def exclusions = it.exclusions.exclusion
    if (exclusions.size() > 0) {
        printComplexDependency(it, scope)
    } else {
        printBasicDependency(it, scope)
    }
}

/**
 * complex print statement does one extra task which is iterate over each
 * ‘exclusion’ node and print out the artifact id.
 */
private def printComplexDependency(it, scope) {
    println "addDependency(['${scope}'], \"${contructSignature(it)}\" ) {"
    it.exclusions.exclusion.each() {
        println "   exclude(module: '${it.artifactId}')"
    }
    println "}"
}

/**
 * Print out the basic form og gradle dependency
 */
private def printBasicDependency(it, String scope) {
    def classifier = contructSignature(it)
    println "${scope}: \"${classifier}\""
}

/**
 * Construct and return the signature of a dependency, including it's version and
 * classifier if it exists
 */
private def contructSignature(it) {
    def gradelDep = "${it.groupId.text()}:${it.artifactId.text()}:${it?.version?.text()}"
    def classifier = elementHasText(it.classifier) ? gradelDep + ":" + it.classifier.text().trim() : gradelDep
    return classifier
}

/**
 * Check to see if the selected node has content
 */
private boolean elementHasText(it) {
    return it.text().length() != 0
}

// for each collection, one at a time, we take each element and call our print function
compileTimeScope.each() { printGradleDep("compile", it) }
runTimeScope.each() { printGradleDep("runtime", it) }
testScope.each() { printGradleDep("testCompile", it) }
providedScope.each() { printGradleDep("provided", it) }
systemScope.each() { printGradleDep("system", it) }

Which converts this:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
<parent>
		<groupId>asdfsafd</groupId>
		<artifactId>asdfsafd</artifactId>
		<version>asdfsadf</version>
		<relativePath>../pom.xml</relativePath>
	</parent>

	<groupId>awf3</groupId>
	<artifactId>asf</artifactId>
<packaging>asfe</packaging>
	<name>asfeasef</name>
<profiles>
<profile>
			<id>jetty</id>
			<activation>
<property>
					<name>jetty</name>
				</property>
			</activation>
			<dependencies>
				<!-- For local data source -->
				<dependency>
					<groupId>oracle.jdbc.driver</groupId>
					<artifactId>OracleDriver</artifactId>
					<version>10.2.0.3</version>
					<!-- <version>11.1.0.6</version> -->
					<scope>compile</scope>
				</dependency>
				<dependency>
					<groupId>javax.jms</groupId>
					<artifactId>jms</artifactId>
					<version>1.1</version>
					<scope>compile</scope>
				</dependency>
			</dependencies>
		</profile>
	</profiles>

	<!-- All the commons logging exclusions can be removed now -->
	<dependencies>
		<!-- Used in JUnit tests -->
		<dependency>
			<groupId>org.easymock</groupId>
			<artifactId>easymock</artifactId>
			<version>2.3</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.easymock</groupId>
			<artifactId>easymockclassextension</artifactId>
			<version>2.2.2</version>
			<scope>test</scope>
			<classifier>jdk14</classifier>
		</dependency>
		<!-- WebSphere library. Compile time dependency from OracleUtils in order to
			unwrap connections to call Oracle's setSessionTimezone for
			TIMESTAMP WITH LOCAL TIME ZONE data type. -->
		<dependency>
			<groupId>com.ibm</groupId>
			<artifactId>WebSphere-Runtime</artifactId>
			<version>6.1.0.13</version>
			<scope>system</scope>
			<!-- the following path must be on on one line-->
			<systemPath>
				c:/progra~1/IBM/SDP70/runtimes/base_v61/plugins/com.ibm.ws.runtime_6.1.0.jar
			</systemPath>
		</dependency>
		<!-- Connection pooling and testing (keep-alive) -->
		<dependency>
			<groupId>c3p0</groupId>
			<artifactId>c3p0</artifactId>
			<version>0.9.1.2</version>
			<scope>compile</scope>
		</dependency>
		<!-- JaxB Message classes -->
		<dependency>
			<groupId>com.fonterra.tams</groupId>
			<artifactId>msg-classes</artifactId>
			<version>1.0.0</version>
		</dependency>
		<!-- Compile dependency and used for testing. Is provided in WS environment -->
		<dependency>
			<groupId>oracle.jdbc.driver</groupId>
			<artifactId>OracleDriver</artifactId>
			<version>10.2.0.3</version>
			<!-- <version>11.1.0.6</version> -->
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.struts</groupId>
			<artifactId>struts-core</artifactId>
			<version>1.3.8</version>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.apache.struts</groupId>
			<artifactId>struts-extras</artifactId>
			<version>1.3.8</version>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.apache.struts</groupId>
			<artifactId>struts-taglib</artifactId>
			<version>1.3.8</version>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.apache.ibatis</groupId>
			<artifactId>ibatis-sqlmap</artifactId>
			<version>2.3.0</version>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>2.5</version>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-beans</artifactId>
			<version>2.5</version>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>2.5</version>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-orm</artifactId>
			<version>2.5</version>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate</artifactId>
			<!-- 			<version>3.3.0-SNAPSHOT-TAMS-CUSTOM</version> -->
			<version>3.2.5.ga</version>
			<scope>compile</scope>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>commons-lang</groupId>
			<artifactId>commons-lang</artifactId>
			<version>2.3</version>
		</dependency>
		<!-- Not used by application - only used by jax bean generator -->
		<!--
			<dependency>
			<groupId>com.sun.xml.bind</groupId>
			<artifactId>jaxb-xjc</artifactId>
			<version>2.0.3</version>
			</dependency>
		-->
		<!-- Used at com.fonterra.tams.util.SchemaUtil.init(SchemaUtil.java:65) -->
		<dependency>
			<groupId>com.sun.xml.bind</groupId>
			<artifactId>jaxb-impl</artifactId>
			<version>2.0.3</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>javax.xml.bind</groupId>
			<artifactId>jaxb-api</artifactId>
			<version>2.1</version>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>opensymphony</groupId>
			<artifactId>sitemesh</artifactId>
			<version>2.3</version>
		</dependency>

		<dependency>
			<groupId>displaytag</groupId>
			<artifactId>displaytag</artifactId>
			<version>1.1</version>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>javax.jms</groupId>
			<artifactId>jms</artifactId>
			<version>1.1</version>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>org.dbunit</groupId>
			<artifactId>dbunit</artifactId>
			<version>2.2</version>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.4</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.openqa.selenium.client-drivers</groupId>
			<artifactId>selenium-java-client-driver</artifactId>
			<version>${selenium-version}</version>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.openqa.selenium.server</groupId>
					<artifactId>selenium-server</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.openqa.selenium.server</groupId>
					<artifactId>selenium-server-coreless</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.openqa.selenium.server</groupId>
			<artifactId>selenium-server</artifactId>
			<version>${selenium-version}</version>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>joda-time</groupId>
			<artifactId>joda-time</artifactId>
			<version>1.5</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>1.4.3</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>1.4.3</version>
		</dependency>
		<!-- work around for jetty commons logging issue -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jcl104-over-slf4j</artifactId>
			<version>1.4.3</version>
		</dependency>

		<!--
			<dependency>
			<groupId>commons-logging</groupId>
			<artifactId>commons-logging</artifactId>
			<version>1.1.1</version>
			</dependency>
		-->
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.14</version>
		</dependency>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-io</artifactId>
			<version>1.3.2</version>
		</dependency>
		<dependency>
			<groupId>jscience</groupId>
			<artifactId>jscience</artifactId>
			<version>4.3.1</version>
		</dependency>
		<dependency>
			<groupId>org.google</groupId>
			<artifactId>google-collect</artifactId>
			<!-- version represents Google's snapshot release date
				(we don't want to use SNAPSHOT qualifier because there
				isn't anything to qualify it to yet. -->
			<version>0.20071022-BETA</version>
		</dependency>
		<!-- Hibernate optional dependency -->
		<dependency>
			<groupId>cglib</groupId>
			<artifactId>cglib</artifactId>
			<version>2.1_3</version>
			<scope>runtime</scope>
		</dependency>
		<!-- Used by JSP pages -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
			<version>1.1.2</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>taglibs</groupId>
			<artifactId>standard</artifactId>
			<version>1.1.2</version>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.5</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jsp-api</artifactId>
			<version>2.0</version>
			<scope>provided</scope>
		</dependency>
	</dependencies>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>commons-logging</groupId>
				<artifactId>commons-logging</artifactId>
				<version>99.0-does-not-exist</version>
			</dependency>
			<dependency>
				<groupId>commons-logging</groupId>
				<artifactId>commons-logging-api</artifactId>
				<version>99.0-does-not-exist</version>
			</dependency>
		</dependencies>
	</dependencyManagement>
<properties>
		<l2>[2,)</l2>
		<l1>[1,)</l1>
		<selenium-version>0.9.2</selenium-version>
		<basedir>/</basedir>
	</properties>

	<repositories>
		<repository>
			<id>no-commons-logging</id>
			<name>No-commons-logging Maven Repository</name>
			<layout>default</layout>
			<url>http://no-commons-logging.zapto.org/mvn2</url>
		</repository>
		<repository>
			<releases />
			<id>local</id>
			<name>local</name>
			<url>file:///${basedir}/m2Repository</url>
		</repository>
		<repository>
			<id>openqa-repository</id>
			<name>OpenQA Repository</name>
			<url>http://maven.openqa.org/</url>
		</repository>
	</repositories>

</project>

To output which looks like this:

Working path:C:\workspaces\mavenDepConvert\src\.
compile: "c3p0:c3p0:0.9.1.2"
compile: "com.fonterra.tams:msg-classes:1.0.0"
compile: "oracle.jdbc.driver:OracleDriver:10.2.0.3"
addDependency(['compile'], "org.apache.struts:struts-core:1.3.8" ) {
   exclude(module: 'commons-logging' )
}
addDependency(['compile'], "org.apache.struts:struts-extras:1.3.8" ) {
   exclude(module: 'commons-logging' )
}
addDependency(['compile'], "org.apache.struts:struts-taglib:1.3.8" ) {
   exclude(module: 'commons-logging' )
}
addDependency(['compile'], "org.apache.ibatis:ibatis-sqlmap:2.3.0" ) {
   exclude(module: 'commons-logging' )
}
addDependency(['compile'], "org.springframework:spring-web:2.5" ) {
   exclude(module: 'commons-logging' )
}
addDependency(['compile'], "org.springframework:spring-beans:2.5" ) {
   exclude(module: 'commons-logging' )
}
addDependency(['compile'], "org.springframework:spring-jdbc:2.5" ) {
   exclude(module: 'commons-logging' )
}
addDependency(['compile'], "org.springframework:spring-orm:2.5" ) {
   exclude(module: 'commons-logging' )
}
addDependency(['compile'], "org.hibernate:hibernate:3.2.5.ga" ) {
   exclude(module: 'commons-logging' )
}
compile: "commons-lang:commons-lang:2.3"
compile: "javax.xml.bind:jaxb-api:2.1"
compile: "opensymphony:sitemesh:2.3"
addDependency(['compile'], "displaytag:displaytag:1.1" ) {
   exclude(module: 'commons-logging' )
}
compile: "javax.jms:jms:1.1"
compile: "joda-time:joda-time:1.5"
compile: "org.slf4j:slf4j-api:1.4.3"
compile: "org.slf4j:slf4j-log4j12:1.4.3"
compile: "org.slf4j:jcl104-over-slf4j:1.4.3"
compile: "log4j:log4j:1.2.14"
compile: "org.apache.commons:commons-io:1.3.2"
compile: "jscience:jscience:4.3.1"
compile: "org.google:google-collect:0.20071022-BETA"
compile: "taglibs:standard:1.1.2"
runtime: "com.sun.xml.bind:jaxb-impl:2.0.3"
runtime: "cglib:cglib:2.1_3"
testCompile: "org.easymock:easymock:2.3"
testCompile: "org.easymock:easymockclassextension:2.2.2:jdk14"
addDependency(['testCompile'], "org.dbunit:dbunit:2.2" ) {
   exclude(module: 'commons-logging' )
}
testCompile: "junit:junit:4.4"
addDependency(['testCompile'], "org.openqa.selenium.client-drivers:selenium-java-client-driver:${selenium-version}" ) {
   exclude(module: 'commons-logging' )
   exclude(module: 'selenium-server' )
   exclude(module: 'selenium-server-coreless' )
}
addDependency(['testCompile'], "org.openqa.selenium.server:selenium-server:${selenium-version}" ) {
   exclude(module: 'commons-logging' )
}
provided: "javax.servlet:jstl:1.1.2"
provided: "javax.servlet:servlet-api:2.5"
provided: "javax.servlet:jsp-api:2.0"
system: "com.ibm:WebSphere-Runtime:6.1.0.13"}}

July 7, 2008

Grow a pair and cut your ties to the queen!

Filed under: General — Antony Stubbs @ 5:06 pm

Stephen Colbert funny as usual – in this episode at about 12:00 he has a few things to say about our sports men of New Zealand!

http://www.comedycentral.com/colbertreport/full-episodes/index.jhtml?episodeId=173608

Along with a plug for Firefox 3 🙂

« Newer PostsOlder Posts »

Blog at WordPress.com.