Results 1 to 7 of 7

Thread: How to resolve the maven dependecies for vast spring and 3rd part jars?

  1. #1
    Join Date
    May 2010
    Posts
    6

    Unhappy How to resolve the maven dependecies for vast spring and 3rd part jars?

    I am trying to build a build a small web MVC application with Spring with dependencies 2.5.5 hibernate3.2.4ga with transaction aspectj annotations and hsql DB in tomcat6. I faced so many problems while creating the build and deploying as the war file as dependency jar files face compatibility issues files for spring 2.5.5. Lets say for example while using EntityManger in jpa. Hibernate has its own jpa.jar in its distribution. if you use the jpa.jar from spring distribution I get class not found exception. Caused by: java.lang.NoClassDefFoundError: javax/transaction/TransactionManager
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.ja va:2395)

    This is just one example. I got so many NoClassDefFoundError for sl4j api, log4j, java assist and the xml parser versions that I copied all the files physically to web-inf/lib in eclipse to create the build.

    I really want to know how you guys use the dependencies in Maven pom.xml. I am sure this must be a very common problem faced and there should be a standardised approach to using already defined maven pom.xml configurations. Please let me know how to frame the dependencies in pom.xml so that I am sure that I do not face jar file version incompatibility issues.

    Consider this simple example: I want to make a simple web MVC project which uses spring 2.5.5, hibernate 3.2 with transactions, jms & jax-ws (compatible version). Do I need manually add all the depencies to pom and resolve jar incompatibility issues by altering by trial and error? That would surely be horrible.

    Any help would be appreciated and fwded to God for further credit

  2. #2
    Join Date
    Mar 2010
    Location
    Boston, MA
    Posts
    316

    Default

    In the directory where the pom.xml resides run
    Code:
    mvn clean install

  3. #3
    Join Date
    May 2010
    Posts
    6

    Unhappy did not help

    Mahesh,
    mvn clean install will not be helpful fyou do not have correct dependencies in the pom.xml file. My problem is that I need correct dependencies list in the pom.xml. I wanted to know if I can find pom.xml already confirgured with dependencies for spring 2.5.5 hibernate 3.2.4ga, transactions, JMS & jax-ws api anywhere? It would be great help if you can point me to it.

  4. #4
    Join Date
    Mar 2010
    Location
    Boston, MA
    Posts
    316

    Default

    Hmm..did you check any of the sample apps that ship with the spring api..they usually have dependencies defined with maven

  5. #5
    Join Date
    May 2010
    Posts
    6

    Default Spring 2.5.5 sample apps do not have pom.xml

    Hi Mahesh,
    I found that the sample apps downloaded with Spring 2.5.5 with dep zip uses build.xml files. It does not have pom.xml in the sample apps. I can see pom.xml when I try to download the sample apps from springsource download apps. But there the pom.xml file uses spring 3.0.0. Can I safely edit the pom to use spring 2.5.5.RELEASE instead keeping all other dependencies untouched? OR can I download the spring 2.5.5 asample appl pom.xml files from somewhere pls?

    <packaging>war</packaging>
    <version>1.0.0-SNAPSHOT</version>
    <properties>
    <spring.version>3.0.0.RELEASE</spring.version>
    <slf4j.version>1.5.6</slf4j.version>
    </properties>
    <dependencies>

  6. #6

    Default

    Take a look at the Spring's sample projects at https://src.springframework.org/svn/spring-samples/

    Most of them are Maven based and have dependencies clearly defined.

  7. #7
    Join Date
    May 2010
    Posts
    6

    Default Got error when tried to change pom.xml in petclinic sample appl to use spring 2.5.5

    I tried to change the pom.xml in the petclinic sample application to use the Spring 2.5.5 depencies as it was using spring 3.0.0 dependencies and got this error below. How to change to spring 2.5.5 dependency pls?

    <properties>
    <spring.version>2.5.5.RELEASE</spring.version>
    <slf4j.version>1.5.6</slf4j.version>
    </properties>
    <dependencies>

    <!-- Spring -->
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>org.springframework.context</artifactId>
    <version>${spring.version}</version>
    <exclusions>
    <!-- Exclude Commons Logging in favor of SLF4j -->
    <exclusion>
    <groupId>org.apache.commons</groupId>
    <artifactId>com.springsource.org.apache.commons.lo gging</artifactId>
    </exclusion>
    </exclusions>
    </dependency>


    ================================================== ===

    Error received:


    [INFO] Unable to find resource 'org.springframework:org.springframework.web.serv
    let:jar:2.5.5.RELEASE' in repository com.springsource.repository.bundles.snapsho
    t (http://repository.springsource.com/m...ndles/snapshot)
    Downloading: http://repo1.maven.org/maven2/org/sp....springframewo
    rk.web.servlet/2.5.5.RELEASE/org.springframework.web.servlet-2.5.5.RELEASE.jar
    [INFO] Unable to find resource 'org.springframework:org.springframework.web.serv
    let:jar:2.5.5.RELEASE' in repository central (http://repo1.maven.org/maven2)
    [WARNING] An error occurred during dependency resolution.
    Failed to retrieve org.springframework:org.springframework.web.servle t-2.5.5
    .RELEASE
    Caused by: Unable to download the artifact from any repository

    Try downloading the file manually from the project website.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •