Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven: generating several "artifacts" with a same pom file?

Tags:

maven

I have a project here which, currently, uses one pom.xml (link) to generate one "artifact".

What I'd like to do is split the project, let's call it p, into:

  • p-core, which contains the core validation process;
  • p-format, which contains the "format" keyword validation, which depends on p-core.

The reason I want to do this is dependencies: p-format pulls in more than 70% of them in volume alone, and not many uses of JSON Schema require format support anyway.

Do I need to build two entirely separate projects, or can I use one pom.xml to generate these two artifacts? I guess the latter is doable, since lots of projects already do that (Jackson, for example).

[In the event that it would have any importance, I publish via Sonatype's maven repo]

like image 658
fge Avatar asked Apr 24 '12 13:04

fge


1 Answers

You should create two separated projects (two separated POMs), but probably a good idea would be to create common parent for them that also aggregate them as modules. Look at Project Inheritance and Project Aggregation sections of Introduction to the POM for some basics.

In Maven, it's never a good idea to try to hack it so it produces many different artifacts from one POM.

like image 143
Michał Kalinowski Avatar answered Oct 07 '22 23:10

Michał Kalinowski