user3401132
user3401132

Reputation: 139

Maven dependencies for Spring beans & Hibernate

I am trying to define the dependencies for Spring & Hibernate on a Maven project on NetBeans. It is a "Maven Webapp", however i will be using Spring only for its bean container-- not MVC. The web component of the project is very light and i'm doing it myself on a servlet. The question here may be "why Maven": Maven is for some other components likely to come in at the backend on this project.

The dependencies in pom.xml are as follows:

<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>3.8.1</version>
  <scope>test</scope>
</dependency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring</artifactId>
    <version>2.5.6</version>
</dependency>

<!-- Spring AOP dependency -->
    <dependency>
            <groupId>org.springframework</groupId>
    <artifactId>spring-aop</artifactId>
    <version>4.0.1.RELEASE</version>
</dependency>

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.25</version>
</dependency>

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate</artifactId>
    <version>3.2.3.ga</version>
</dependency>

<!-- Hibernate library start -->    
<dependency>
    <groupId>dom4j</groupId>
    <artifactId>dom4j</artifactId>
    <version>1.6.1</version>
</dependency>

<dependency>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging</artifactId>
    <version>1.1.1</version>
</dependency>

<dependency>
    <groupId>commons-collections</groupId>
    <artifactId>commons-collections</artifactId>
    <version>3.2.1</version>
</dependency>

<dependency>
    <groupId>antlr</groupId>
    <artifactId>antlr</artifactId>
    <version>2.7.7</version>
</dependency>
<!-- Hibernate library end -->

To this and some other things I tried, I keep getting the following error:

Failed to execute goal on project SomePrj: Could not resolve dependencies for project SomePrj.root:SomePrj:war:1.0-SNAPSHOT: Failure to find javax.transaction:jta:jar:1.0.1B in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

1) What am i doing wrong???

2) Do I need spring-aop dependency to use the Spring bean container only?

Note: I saw maven missing dependency jta-1.0.1b and some other Qs along the same line.

TIA

Upvotes: 1

Views: 903

Answers (2)

user3401132
user3401132

Reputation: 139

Added the following to pom.xml & worked:

<project>
...
<repositories>
    <repository>
        <id>central</id>
        <url>http://java.sun.com/products/jta</url>
    </repository>
</repositories>
...
</project>

Upvotes: 1

Jigar Joshi
Jigar Joshi

Reputation: 240908

You don't need spring-aop if you are just wanting to use dependency container, regarding your error try putting -U in your mvn command

for example:

mvn clean install -U

if it still fails add central explicitly in your repository list

<project ...>
<repositories>
    <repository>
      <id>central</id>
      <url>http://central.maven.org/maven2</url>
    </repository>
 </repositories>
</project>

Upvotes: 0

Related Questions