i have several projects need inherit different parents stored in repository.
child-1 -> parent-1 (in repo) child-2 -> parent-2 (in repo) ... the child pom.xml looks this:
<project> <parent> <groupid>com.company</groupid> <artifactid>parent-x</artifactid> <relativepath/> </parent> <artifactid>child-x</artifactid> <name>child x</name> <repositories> <repository> <!-- repo parent located --> </repository> </repositories> </project> since parents located in same repo, i'd reuse repositories section in child poms, rather copy-pasting it. there way this?
i can't use common parent these child projects because each have different parent, not available locally.
also, adding repository settings.xml not option because code reused other developers might not have setting.xml set-up properly.
it not possible. there 3 mechanisms in maven factor out configuration place can reused:
- settings.xml - ruled out because developers might not have set up
- parent pom - ruled out due setup
- "importing" pom - not work in case. adding dependency type "pom" , scope "import" imports managed dependencies target pom not source repository.
i'd recommend using settings.xml , writing documentation developers - or - if can publish parent poms maven central or internal company repository can use them , developers have access to.
Comments
Post a Comment