Rotten Code

Not just bad, it's rotten...

Tuesday, March 27, 2007

Maven2 and Sun: (javax.transaction:jta:jar:1.0.1B)

I've been essentially working in isolation for the past two months as I draft out the outlines for the Lime Wire Store. One tool that I've picked up that I hadn't used before is Maven (2). Maven does a number of things for your build process, managing dependencies is the one I'll talk about here.

While working on my own machine, I got a basic framework for the store running, using Maven2, Spring, Hibernate, etc. Everything was running great. While I've been working on this, I was working to hire the team that's actually going to build this beast. The first wave of developers will be starting here over the next few weeks, so I needed to pull back and document the environment so that a new developer could come in and check out the code and have it actually compile. I figured that would be a nice feature.

So I set up a VMWare box with a fresh install of Eclipse, and began documenting. Add the AspectJ plugin. Add MyEclipseID. Add the Maven2 Plugin. Add Subclipse. OK, everything's there, let's start building... Maven began to chug away downloading the many dependencies it needed for compilation. Everything was going great until Hibernate started, and failed due to its requirement on JTA (java.transaction). Long story short, the jta.jar must be downloaded from Sun's site manually due to their license terms. What a pain!

But the real mystery is this: How did I ever use Hibernate on my original machine? I guess the answer must be that the Hibernate pom has changed and added the dependency, so it worked back then because it didn't need to pull the jta at all.

Well, I didn't want to have to run the manual download, then run 'mvn install', 1) because it's a pain and 2) because I don't even have a command-line Maven install on my box because I'm using the Maven2 Eclipse plugin! So I needed another solution, and the following change to my pom resolved the issue... Whether everything works or not is another matter, which will be followed up later!

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.1.ga</version>
<exclusions>
<exclusion>
<artifactId>jta</artifactId>
<groupId>javax.transaction</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.0.1B_spec</artifactId>
<version>1.1</version>
</dependency>

2 Comments:

At 10:42 PM, Blogger Eric said...

Check out the java.net repo:

https://maven-repository.dev.java.net/

 
At 9:25 AM, Blogger Jason said...

Thanks Eric! That repository has the 1.1 jta, not 1.0.1B, so I still get the same error without adding the exclusion. But I feel more comfortable with the actual Sun JTA in there. Very helpful, thank you!

For those of you at home, instead of my original, you can try adding the java.net repository and then point to the 1.1 version of JTA:

<repository>
<id>java.net</id>
<url>https://maven-repository.dev.java.net/nonav/repository</url>
<layout>legacy</layout>
</repository>

<dependency>
<groupId>javax.transaction</groupId>
<artifactId>transaction-api</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.1.ga</version>
<exclusions>
<exclusion>
<artifactId>jta</artifactId>
<groupId>javax.transaction</groupId>
</exclusion>
</exclusions>
</dependency>

 

Post a Comment

<< Home