0

I'm going to be building a project from the Spring Examples package. Specifically, I am going to be building onto the Simple JPA Example. When I view the POM file however I notice that it references a parent, which contains pretty much every Spring project you can imagine.

Is there a way to tell which POM files I need in order to have the 'Simple JPA Example' project work?

EDIT: This is why Maven needs to go away!

Dan
  • 979
  • 1
  • 8
  • 29

2 Answers2

0

Which parent pom is it (and which sample)? If it's this one have another look at the parent - it doesn't define any dependencies, only dependency management, so that you get a consistent set of versions of everything without having the specify versions in your own dependencies. It's quite a common pattern (look for a blog on "bill of materials" configuration). See also docs on how to use your own parent.

Dave Syer
  • 56,583
  • 10
  • 155
  • 143
  • It's the simple-jpa example – Dan Mar 05 '14 at 12:38
  • Found here https://github.com/spring-by-example/spring-by-example/tree/master/persistence/simple-jpa Would it be better to follow the spring.io guides? – Dan Mar 05 '14 at 12:46
  • spring.io guides are more up to date, and if the spring-by-exmaple projects all have a humungous parent pom, I'd say that was a reason for not using them in production (but fine for pedagogical purposes). – Dave Syer Mar 05 '14 at 14:36
  • Any thoughts on figuring out which dependencies I truly needs vs putting them all in? – Dan Mar 05 '14 at 14:44
  • Sorry, can't help with that at the moment (although it's something I've always thought should be automated - it's a hard problem in terms of cranking through all the combinations and having a good enough test suite). – Dave Syer Mar 05 '14 at 15:42
0

You can move all the dependencies into the project's pom, remove the reference to the parent pom, then use the maven dependency plugin's analyze goal to sort out what you need. There are examples and a rather nifty script referenced from this popular SO question.

Community
  • 1
  • 1
Paul Hicks
  • 13,289
  • 5
  • 51
  • 78