maven: generating several “artifacts” with a same pom file?

后端 未结 4 1932
栀梦
栀梦 2021-01-04 11:30

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:

4条回答
  •  礼貌的吻别
    2021-01-04 11:52

    I had a similar case and I agree with Michal's suggestion. However, I would like to extend the proposed solution further:

    I'm assuming p has a single source and both p-core and p-format are generated from it. So you should create a parent POM for p with children modules (with their respective POMs) -- one for 'core' and one for 'format' but have these both source from the parent's /src/.

    So essentially we segregating the build processes for 'core' and 'format' to generate specific artifacts but not replicating the original sources for p.

    Maven supports but does not recommended this approach but I don't see why they shouldn't. In my opinion, its structured, clean and concern-seperating without any long-term implications and there is no better alternative.

    http://maven.apache.org/guides/mini/guide-using-one-source-directory.html

提交回复
热议问题