naiquevin
naiquevin

Reputation: 7796

Eclipse giving out an error while adding springframework dependency in maven .pom

I created a Maven project in Eclipse using the webapp artifact and put the following lines in the .pom file upon reading an online tutorial.

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring</artifactId>
  <version>3.0.5.RELEASE</version>
</dependency>

In the tutorial however, the version is 2.5.6. I replaced it with 3.0.5.RELEASE considering its the latest version.

But for this version eclipse is giving out an error

Missing artifact org.springframework:spring:jar:3.0.5.RELEASE:compile

What does this mean ? Can I add the required jar files to a lib folder and ask .pom file to take it from there as its being done in another tutorial on spring source website that uses Ant ?

Also Maven projects come with a different directory structure and seems to be doing much more than what Ant does in the spring source tutorial.

I am completely new to maven. in fact only a beginner in developing web applications using java. I did some tutorials from spring source and could deploy and run a spring mvc hello world app on apache tomcat. For this I used Ant and found it a great tool. But as I checked-out some example apps from spring source repo and it seems that Maven is more preferred and powerful than Ant. I am finding it a bit difficult to understand though.

Thanks

Upvotes: 3

Views: 3749

Answers (2)

Sean Patrick Floyd
Sean Patrick Floyd

Reputation: 298818

In version 3, Spring no longer provides the all-in-one Spring jar.

Note: The spring.jar artifact that contained almost the entire framework is no longer provided.

Source:


Depending on your project needs, use

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>${artifactId}</artifactId>
    <version>3.0.5.RELEASE</version>
</dependency> 

where ${artifactId} may be e.g.

  • spring-context (IOC core, standard ApplicationContext implementations)
  • spring-orm (ORM technologies: Hibernate, JPA, (I|My)Batis)
  • spring-webmvc (The Spring Web MVC framework)
  • spring-aop (Aspect-Oriented Programming support)

etc.

The selected dependencies will pull in their required libraries as transitive dependencies, so you usually just need the "most exotic technology". E.g. if you select Spring MVC and Spring ORM, you also get AOP, TX, Context, Web etc.

Reference:

Upvotes: 4

axtavt
axtavt

Reputation: 242686

In Spring 3.x they remove they removed this artifact. Now you have to declare dependencies on separate modules of Spring, such as

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>3.0.5.RELEASE</version>
</dependency> 

and so on.

Also see spring 3.0.5 library jars for the list of modules and description of dependencies between them.

Upvotes: 0

Related Questions