Hi, Here is my proposal...
Inside your main/parent pom.xml, set the following: <project> ... <properties> <repo.name>foo</repo.name> <repo.url>boo</repo.url> </properties> <repositories> <repository> <id>${repo.name}</id> <url>${repo.url}</url> </repository> </repositories> ... </project> And your maven command should like: mvn <whatever phase> -Drepo.name=some.repo.name -Drepo.url=relevant.url What do you say? YG -----Original Message----- From: Nicolas Brasey [mailto:nicolas.bra...@gmail.com] Sent: Monday, April 09, 2018 20:41 To: users@maven.apache.org Subject: A maven plugin to add dynamically a repository at build time Hi, In my continuous integration solution, I need to have a maven repository which is calculated based on the git branch name. For example, I have a naming convention which is used to calculate the maven repo URL, something similar to this: Branch name -> Git Repo URL: ------------------- --------------------- develop -> https://urldefense.proofpoint.com/v2/url?u=http-3A__archiva_repositories_snapshot&d=DwIBaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=GYb_8qONFTPgVpTfZRT53aEptjaOm6sDrruaOwiowLQ&m=wYKDMhCmuL6gf7KPllHND78qrm6EwCIeSTQMt6cv268&s=YFvvW16iOsJQtkao0hwVmS33Rh07ba1sfucC1yHSwFI&e= feature/xxx -> https://urldefense.proofpoint.com/v2/url?u=http-3A__archiva_repositories_feature-2Dxxx&d=DwIBaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=GYb_8qONFTPgVpTfZRT53aEptjaOm6sDrruaOwiowLQ&m=wYKDMhCmuL6gf7KPllHND78qrm6EwCIeSTQMt6cv268&s=tUqew2vcZMbgd3HbH8wWGoTp_v94pBrDATIHUCug8jw&e= staging/xxx -> https://urldefense.proofpoint.com/v2/url?u=http-3A__archiva_repositories_staging-2Dxxx&d=DwIBaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=GYb_8qONFTPgVpTfZRT53aEptjaOm6sDrruaOwiowLQ&m=wYKDMhCmuL6gf7KPllHND78qrm6EwCIeSTQMt6cv268&s=KXqHxpLtHwoU86yY9ySm1QrSBtaoN7lsraCeF6DW9dw&e= I wrote a maven plugin that adds dynamically a repository in my project but unfortunately, my plugin is not invoked before maven performs the dependency resolution. I googled it and tried some workaround proposed (like putting my plugin in the pre-clean phase), but it still executes after the dependency resolution. You guys ever tried this? Thanks, Nicolas