pradeep3009
pradeep3009

Reputation: 37

How to create 2 maven projects with single POM file

For example I have a project X and I have to create JMH project Y but as there is no need of any other extra dependecies, I don't want to create another POM for project Y instead I can make use of project X POM file.

How can we achieve that?

Upvotes: 0

Views: 635

Answers (3)

eis
eis

Reputation: 53472

There's several alternatives. More straight forward are:

  • create a parent pom with dependencies and inherit that OR
  • create a dependency pom and import that OR
  • create a BOM (bill-of-materials) and import that

into both of your projects. That takes care of the dependencies, but you need to have separate pom xmls for other stuff that is in there - at least artifact id and its version. They don't need to contain much but they need to be present for maven build to work.

Upvotes: 1

You can try a single IntelliJ Idea project, create a pom.xml, and create 2 dirs that will be your projects.

For example:

  • .idea
  • projectXDir
  • prokectYDir
  • pom.xml
  • other files

Upvotes: 0

J Fabian Meier
J Fabian Meier

Reputation: 35805

Every project needs a POM file.

If you have common configuration, you can create a parent POM and use it in both projects.

Upvotes: 1

Related Questions