• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Proper way of identifying Spring's Maven dependencies

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I have been doing Spring's MVC4 and JPA development without using Maven because Netbeans allows me to create new projects using Spring's MVC framework and adding JPA features by doing right click on the project -> New -> Other -> Persistence, and selecting whether I want to add Entity Classes or do reverse engineer from database. So far so good.

I now want to start using Spring Data and when you look at their project page at http://projects.spring.io/spring-data-jpa/#quick-start, you'd see the following.


Looking at Section 2.2.4 Data Access/Integration of the Spring Framework doc at http://docs.spring.io/spring-framework/docs/current/spring-framework-reference/html/overview.html#overview-modules, we can see it contains the following modules:
spring-jdbc (downloaded via dependency on spring-data-jpa artifact)
spring-tx (downloaded via dependency on spring-data-jpa artifact)
spring-orm (downloaded via dependency on spring-data-jpa artifact)
spring-oxm (not downloaded)
spring-jms (not downloaded)

So far so good for Spring Data. I think the only thing I need to add are the database libraries and ORM.

Now for Spring MVC, there isn't a Spring Project listed for Web MVC like there is for Spring Data. Reading the same Spring Framework Overview, I see the web modules are also part of the Spring Framework. But if you visit the Spring Framework project page at http://projects.spring.io/spring-framework/, you'd see the following Maven dependency:


Adding this would pull in all of the following modules, if they haven't been downloaded yet:
spring-core
spring-beans
spring-context
spring-expression

Reading on the same Spring Framework Overview under Section 2.2.5 Web, I see the following modules listed:
spring-web
spring-webmvc
spring-websocket
spring-webmvc-portlet

However, Spring doesn't have a specific project page for Web like it does for Spring Data and Spring Framework. Now following are the questions that cross my mind:
1) Just which one of these 4 can I add that to the POM dependency list will automatically pull in all 4? Or do I have to add them individually? Digging on http://mvnrepository.com for spring-web, I found it on http://mvnrepository.com/artifact/org.springframework/spring-web/4.1.1.RELEASE with the following POM dependency but this isn't pulling in spring-webmvc, spring-websocket, etc.

2) What version number should I use? I wouldn't know unless I do the search on http://mvnrepository.com. Is this the only way to do this?

The only thing it appears I can do is to try looking up the versions and dependency on http://mvnrepository.com, and try to see what each depends on to see whether I can just add one to download all 4 or have to add all of them. So is this the proper way of approaching this? How is everyone doing this without so much digging around? Why doesn't Spring offers a project page for web development like it does for Spring Data?
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Spring webmvc will pull in spring-web as a transitive dependency. You can see this clearly if you look at maven central (scroll down the page to see the dependencies)

http://mvnrepository.com/artifact/org.springframework/spring-webmvc/4.1.1.RELEASE

Spring core and web are all versioned together the latest is 4.1.1.RELEASE. Don't mix the versions. Spring Data is versioned differently however the newest version is only compatible with the 4.x Spring.

websockets and portlets are separate animals so if you want one you will have to pull it in. Both of those will pull in both spring-web and spring-webmvc.

To print out all your dependencies you can run

 
Mike Cheung
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bill Gorder wrote:Spring webmvc will pull in spring-web as a transitive dependency. You can see this clearly if you look at maven central (scroll down the page to see the dependencies)

http://mvnrepository.com/artifact/org.springframework/spring-webmvc/4.1.1.RELEASE

Spring core and web are all versioned together the latest is 4.1.1.RELEASE. Don't mix the versions. Spring Data is versioned differently however the newest version is only compatible with the 4.x Spring.

websockets and portlets are separate animals so if you want one you will have to pull it in. Both of those will pull in both spring-web and spring-webmvc.

To print out all your dependencies you can run


Thanks for the reply. So I guess you are confirming that it is normal and typical for one to have to dig around on mvnrepository.com in order to find out which Spring module to be added. I just thought that I wasn't looking at the right place because typically there is a Maven dependency XML provided per Spring project like the following for Spring Data, but I haven't seen one for Spring Web.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This makes things easier: Maven "Bill Of Materials" Dependency
reply
    Bookmark Topic Watch Topic
  • New Topic