Scratch building a Maven POM

jim

What process do you fine SO folk use when setting up an existing project for Maven building?

I understand the first thing is replace the jars and add Maven dependency declarations.

I am working with quite a large project with various components and POM.xml files. Is it a good idea to start at the deepest level and get the sub modules to build correctly, then move up a level once all POMs on that level build.

Can somebody please explain the concept of "Parent POMs" that don't really contain or build code, they are their just to define the sub modules? Why do these need to be installed to the repository (or do they)? Thanks.

hzpz

First of all, you need to decide about the overall structure: Do you want to have a huge multi-module Maven project or smaller separate Maven projects that depend on one another. The advantage of the former is that your build process is easier (just mvn clean install to build the whole project, just one Jenkins job etc.). The latter however makes it easier to separate work. You could, for example, have one team implement, build and deploy some component and another team just has to add a dependency to the artifact. No need for them to checkout the code and build it themselves.

Then, you need to start at the deepest level, meaning the components, that have no dependencies to other components. Otherwise you won't be able to use <dependencies> in the Maven sense.

Let's say, you have three components, A, B and C. A depends on B and B depends on C. So you would convert C to Maven first. The <dependencies> section in the pom.xml of C would contain only third party dependencies. Now you move to B and add C as a dependency in the pom.xml. The same goes for A with a dependency to B.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related