Re: A maven plugin to add dynamically a repository at build time

2018-04-09 Thread Nicolas Brasey
Hi Yolan,

Thanks for your input.

Yes, what you proposed is what I use at the moment as a workaround. But I
wanted to hide the branch selection logic from the build runner.

I suppose there is no real solution to hook code in maven before even the
dependencies resolution? Is there another API besides the maven plugin
API which allows me for example to extend the default MavenArtifact
resolver?

Nicolas






On Tue, Apr 10, 2018 at 7:22 AM, Golan, Yaron  wrote:

> Hi,
>
> Here is my proposal...
>
> Inside your main/parent pom.xml, set the following:
>
> 
> ...
> 
> foo
> boo
> 
>
> 
> 
> ${repo.name}
> ${repo.url}
> 
> 
> ...
> 
>
>
> And your maven command should like:
> mvn  -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=DwIBaQ=LFYZ-o9_
> HUMeMTSQicvjIg=GYb_8qONFTPgVpTfZRT53aEptjaOm6sDrruaOwiowLQ=
> wYKDMhCmuL6gf7KPllHND78qrm6EwCIeSTQMt6cv268=
> YFvvW16iOsJQtkao0hwVmS33Rh07ba1sfucC1yHSwFI=
> feature/xxx -> https://urldefense.proofpoint.
> com/v2/url?u=http-3A__archiva_repositories_feature-2Dxxx=
> DwIBaQ=LFYZ-o9_HUMeMTSQicvjIg=GYb_8qONFTPgVpTfZRT53aEptjaOm6sDrr
> uaOwiowLQ=wYKDMhCmuL6gf7KPllHND78qrm6EwCIeSTQMt6cv268=
> tUqew2vcZMbgd3HbH8wWGoTp_v94pBrDATIHUCug8jw=
> staging/xxx -> https://urldefense.proofpoint.
> com/v2/url?u=http-3A__archiva_repositories_staging-2Dxxx=
> DwIBaQ=LFYZ-o9_HUMeMTSQicvjIg=GYb_8qONFTPgVpTfZRT53aEptjaOm6sDrr
> uaOwiowLQ=wYKDMhCmuL6gf7KPllHND78qrm6EwCIeSTQMt6cv268=
> KXqHxpLtHwoU86yY9ySm1QrSBtaoN7lsraCeF6DW9dw=
>
>
> 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
>


RE: A maven plugin to add dynamically a repository at build time

2018-04-09 Thread Golan, Yaron
Hi,

Here is my proposal...

Inside your main/parent pom.xml, set the following:


...

foo
boo




${repo.name}
${repo.url}


...



And your maven command should like:
mvn  -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=DwIBaQ=LFYZ-o9_HUMeMTSQicvjIg=GYb_8qONFTPgVpTfZRT53aEptjaOm6sDrruaOwiowLQ=wYKDMhCmuL6gf7KPllHND78qrm6EwCIeSTQMt6cv268=YFvvW16iOsJQtkao0hwVmS33Rh07ba1sfucC1yHSwFI=
 
feature/xxx -> 
https://urldefense.proofpoint.com/v2/url?u=http-3A__archiva_repositories_feature-2Dxxx=DwIBaQ=LFYZ-o9_HUMeMTSQicvjIg=GYb_8qONFTPgVpTfZRT53aEptjaOm6sDrruaOwiowLQ=wYKDMhCmuL6gf7KPllHND78qrm6EwCIeSTQMt6cv268=tUqew2vcZMbgd3HbH8wWGoTp_v94pBrDATIHUCug8jw=
 
staging/xxx -> 
https://urldefense.proofpoint.com/v2/url?u=http-3A__archiva_repositories_staging-2Dxxx=DwIBaQ=LFYZ-o9_HUMeMTSQicvjIg=GYb_8qONFTPgVpTfZRT53aEptjaOm6sDrruaOwiowLQ=wYKDMhCmuL6gf7KPllHND78qrm6EwCIeSTQMt6cv268=KXqHxpLtHwoU86yY9ySm1QrSBtaoN7lsraCeF6DW9dw=
 


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