Maven 2: Spring and JTA dependencies

Posted by Lucio Benfante Sat, 26 Nov 2005 15:06:00 GMT

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:

Posted in  | Tags , , ,  | 37 comments

Comments

  1. Avatar sohallor said 476 days later:

    Thanks, very useful!

  2. Avatar fbregnvig said 557 days later:

    Thanks, very helpful indeed!

  3. Avatar cav said 563 days later:

    Thanks , the problem is solved!

  4. Avatar mike said 622 days later:

    Thank you! Clean & concise, this is exactly what I wanted.

  5. Avatar Sumit said 652 days later:

    Thanks, was just what I needed to know.

  6. Avatar Nick said 657 days later:

    thanks man, you saved me a lot of time

  7. Avatar Henrik said 704 days later:

    U can also point the maven rep to: http://download.java.net/maven/2/javax/transaction/jta/1.0.1B/

  8. Avatar dcasiel@yahoo.com said 758 days later:

    Thanks a lot :) This is the only good explanation of the problem that I saw after long search.

  9. Avatar Retschgi said 759 days later:

    Thank you! You made my day!

  10. Avatar James said 761 days later:

    Exactly the information I needed, thanks!

  11. Avatar Imran M Yousuf said 764 days later:

    Thanks! it is quite helpful

  12. Avatar Olivier said 787 days later:

    Thanks a lot :p

  13. Avatar Nuwi said 800 days later:

    Gracias!!!

  14. Avatar Pierre said 835 days later:

    Thanks! It solved my packaging problem!

  15. Avatar Sunil said 900 days later:

    Thanks dude, this helped

  16. Avatar salvi said 917 days later:

    thanks, this solve my problem

  17. Avatar gerardo said 921 days later:

    gracias, me sirvio mucho , directo y conciso

  18. Avatar Jörn Zaefferer said 958 days later:

    Henriks hint at the java.net repository was a very welcome addition. Just add it to your repositories element:

    <repository>
        <id>java.net</id>
        <name>java.net</name>
        <url>http://download.java.net/maven/2/</url>
    </repository>
    
  19. Avatar simon massey said 997 days later:

    N.B. the above approaches of directly injected into your cache or including a different maven server will make our project unportable to other developer workstations as they will have to hack their settings.xml to get things to work. instead you can do the following:

    configure maven to include hibernate artifacts but not the dependency to jta. particularly if you are going to deploy to a container that will provide the class itself you will have to do nothing else. use the following syntax:

    org.hibernate hibernate-entitymanager ${hibernate.version} javax.transaction jta

    if you are actually going to compile against jta then use the geronimo implimentation of the jta library that does not have a liciensing issue.

    org.apache.geronimo.specs geronimo-jta_1.0.1B_spec 1.1.1

    simply go to mvnrepository.com and search for geronimo-jta to find the correct version of the jta spec to include for your project.

    happy coding.

  20. Avatar simon massey said 997 days later:
    that will teach me not to preview! the pom fragments are as follows:
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-entitymanager</artifactId>
                <version>${hibernate.version}</version>
                <exclusions>
                  <exclusion>
                    <groupId>javax.transaction</groupId>
                    <artifactId>jta</artifactId>
                  </exclusion>
                </exclusions>
            </dependency>
    

    and

    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-jta_1.0.1B_spec</artifactId>
        <version>1.1.1</version>
    </dependency>
    
  21. Avatar chris_five said 1024 days later:

    no luck at mvnrepository.com. jar file can be downloaded here: http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/

  22. Avatar felipper said 1482 days later:

    Cool! Exactaly what I want.

  23. Avatar kris said 1539 days later:

    this what i am looking for

  24. Avatar Tyler Pedersen said 1544 days later:

    Very well written. Thanks.

  25. Avatar mvnhtr said 1551 days later:

    And this is still a problem over 4 years later! geez.

  26. Avatar Gustaf said 1570 days later:

    Really helpful! Thanks a lot…/G

  27. Avatar Bakhyt said 1587 days later:

    Thanx, helpful! )))

  28. Avatar Dav said 1889 days later:

    Exactly what I needed – and to the point. Thanks.

  29. Avatar benkt said 2010 days later:

    Thank you!

  30. Avatar Brian Lavender said 2014 days later:

    How do you import the JavaDoc?

  31. Avatar Cheap NFL Jerseys said 2053 days later:

    Lost wealth can be replaced by industry, lost knowledge by study, lost health by temperance or medicine, but lost time is gone for ever.

  32. Avatar Philippe C said 2083 days later:

    Thanks ! This was very helpful !

  33. Avatar AKPK said 2158 days later:

    Thanks problem solved

  34. Avatar amal said 2346 days later:

    thaaaaaaaaaaaaaaaanks a lot

  35. Avatar bo huang said 2444 days later:

    thanks a lot!!

  36. Avatar tgyuytse said 2682 days later:

    jehkjfhjdnhvittrhgdjh

  37. Avatar Mariusz O. said 2744 days later:

    Thank You a lot!!

(leave url/email »)

   Comment Markup Help Preview comment