Saturday 23 June 2007

Maven depgraph plugin: getting a better picture of your Maven dependencies

Dependency management has always been a beeyotch, and it's only gotten
worse over the years. This library needs that and that and that
library, and another jar needs that and that jar. Then you could get
one jar depending on an older version of another jar, and another
requiring a newer one. God knows this leads to simple webapps that
only have 4 classes but so many dependencies that they balloon to 14Mb
.war files!

Maven has been a big help in managing this, but the introduction of
transitive dependencies in Maven2 has also resulted in the developer
knowing even less about what libraries are being used. Granted, the
whole thing saves you from having to specify each and every one of
those dependencies, but the fact you had to do it also meant you at
least *knew* what was going in there. And if there were any errors due
to conflicting library versions, you didn't have to trawl through as
many directories to find out what the conflict was. In Maven2, this
pretty much means you have to go through the .pom files in your
repository, whereas in Maven 1 you just had to look in your project's
project.xml.

Anyway, I came across this blog post about a maven plugin that
generates a diagram showing your maven dependencies:

http://mult.ifario.us/articles/2007/03/07/ok-who-put-the-junit-jar-in-my-war

It uses the very useful GraphViz (http://www.graphviz.org/) to create
the images.

It should be as easy as running:

mvn depgraph:depgraph

Sadly, I couldn't get it to work on my PC. Looks like there's a
parameter you pass in so the plugin knows your local repository -
which is kinda strange, since shouldn't it be able to get this from
Maven, which obviously *would* already have this information? The
parameter "m_localRepository" is a required parameter but the plugin
site (http://el4j.sourceforge.net/plugins/maven-depgraph-plugin/depgraph-mojo.html)
lacks examples of the proper usage. I mucked around and *seemed* to
get it working with a call to:

mvn depgraph:depgraph -Dm_localRepository="C:\localrepository"

But again, that didn't work. One of these days I'll get it working,
but looming deadlines require my attention on more immediate things to
do.

.

Wednesday 20 June 2007

Resolved: stick to Log4j for logging

A pretty clear reason why if it ain't broke, don't fix it.


http://radio.weblogs.com/0122027/2003/08/15.html

" The purpose of Commons Logging is not to isolate your code from
changes in the underlying logging framework. (That's certainly easy
enough to do on your own, and not really worth doing in the first
place given the ease of switching from one logging framework to
another.) The purpose of Commons Logging is not to somehow be more
useful than actual logging frameworks by being more general. The
purpose of Commons Logging is not to somehow take the logging world by
storm. In fact, there are very limited circumstances in which Commons
Logging is useful. If you're building a stand-alone application, don't
use commons-logging. If you're building an application server, don't
use commons-logging. If you're building a moderately large framework,
don't use commons-logging. If however, like the Jakarta Commons
project, you're building a tiny little component that you intend for
other developers to embed in their applications and frameworks, and
you believe that logging information might be useful to those clients,
and you can't be sure what logging framework they're going to want to
use, then commons-logging might be useful to you."

Tuesday 19 June 2007

Tomcat Native library

While working in IntelliJ and running Tomcat, I came across this message:

INFO: The Apache Tomcat Native library which allows optimal
performance in production environments was not found on the
java.library.path: C:\Program
Files\Java\jdk1.5.0_09\bin;.;C:\WINNT\system32;C:\WINNT;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program
Files\Intel\DMIX;C:\javatools\maven-2.0.6\bin;C:\javatools\apache-ant-1.7.0\bin;C:\PROGRA~2\XRay;C:\Program
Files\QuickTime\QTSystem\;C:\Program
Files\jEdit;C:\Sun\jwsdp-2.0\jwsdp-shared\bin

I'd never heard of this library before, so I had a look around and found this:

http://tomcat.apache.org/tomcat-5.5-doc/apr.html

The file is called tcnative-1.dll and is here: http://tomcat.heanet.ie/native/

I placed it in WINNT\System32 and all is sweet. Not that I'd notice it
much, but startup seems to have decreased from 4 to 2 seconds. :P

Saturday 16 June 2007

Launchy - application launcher for Windows, similar to Spotlight on OS X.

I've been looking for a tool similar to Spotlight on OS X that allows
you to start applications by just typing their name. Finally came upon
one - Launch @ http://www.launchy.net/

Just type Alt-Space to bring it up, then type the program name.

Much much better than screwing around with the Start Menu programs list.

(and yes, I know Spotlight does so much more than this)