Questo sito è ancora in costruzione.
L'attuale sito ufficiale del JUG Padova è all'indirizzo www.jugpadova.it

Maven 2: Spring and JTA dependencies

Few weeks ago I started using Maven 2 for one of my development projects. The project is very simple, but it has dependencies with some external libraries, in particular with Spring:

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring</artifactId>
  <version>1.2.6</version>
  <scope>runtime</scope>
</dependency>

Introducing this dependency I had the following errors:

Downloading: ->
    http://repo1.maven.org/maven2/javax/transaction ->
      /jta/1.0.1B/jta-1.0.1B.jar
[WARNING] Unable to get resource from repository central ->
    (http://repo1.maven.org/maven2)
...
[INFO] Failed to resolve artifact.

required artifacts missing:
 javax.transaction:jta:jar:1.0.1B

This happened because Spring has a transitive dependency with the Sun’s JTA classes, but the JTA jar can’t be inserted in the Maven repository because the Sun’s Binary License.

For solving this dependency you have to download the jta-1_0_1B-classes.zip file from the Sun’s site and install it into your local repository using the following command:

mvn install:install-file \
  -Dfile=./jta-1_0_1B-classes.zip \
  -DgroupId=javax.transaction \
  -DartifactId=jta -Dversion=1.0.1B \
  -Dpackaging=jar

More general information in these Maven’s mini guides: