Urr4
Urr4

Reputation: 793

Import Maven plugin

I'm trying to learn Spring at the moment. In nearly every spring tutorial, you start with a project, that has a "spring-starter" project as parent. However, until now I used the parent to define some common dependencies (like junit or yodatime) and plugins (like maven-compiler-plugin) that all my projects should have. I took that common-project as a parent for most of my projects. Now I can't do that, because the role of the parent is occupied by the spring project. I could define the common dependencies and plugins in this project again, but then it seems to be easy to have different verisions and all in all it looks a lot like bad code.

My question now is, is there a way to define a "set" of dependencies and/or plugins and import them into a project without having a parent?

Upvotes: 0

Views: 490

Answers (2)

Urr4
Urr4

Reputation: 793

I didn't have the chance to try it out, but it seems, that the answer of Guillaume Darmont in How to use POMs as a dependency in Maven? is exactly the solution to my problem.

Maybe this was what you (randombee) were trying to tell me, but I didn't quite get it :)

Upvotes: 0

randombee
randombee

Reputation: 719

Normally, what I do in Eclipse is create a general project. After it is created, I do a right click on my project and press Configure -> Convert to maven project. I assume there will be an equivalent way of doing this in Spring.

Another alternative (again in eclipse, sorry if it is different in spring, but it should have an equivalent) is creating a simple maven project:

 New project -> Maven project -> 
 Check on "Create a simple project (skip archetype selection) -> 
 Next -> Enter your artifact group ID and artifact ID and click finish.     

That should do the trick even without selecting a parent application.

I prefer the first alternative, since everything is already filled in for me, but both of them do the same thing.

Upvotes: 1

Related Questions