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 , , ,  | 28 comments

Comments

  1. Avatar sohallor said 477 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 765 days later:

    Thanks! it is quite helpful

  12. Avatar Olivier said 788 days later:

    Thanks a lot :p

  13. Avatar Nuwi said 801 days later:

    Gracias!!!

  14. Avatar Pierre said 836 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 922 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 1025 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 1540 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 1571 days later:

    Really helpful! Thanks a lot…/G

  27. Avatar Bakhyt said 1588 days later:

    Thanx, helpful! )))

  28. Avatar Chirs Miller said 1699 days later:

    nicely explained about decreasing the dependancies. thanks. keep on good work.

(leave url/email »)

   Comment Markup Help Preview comment