You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Lóránt Pintér <lo...@gmail.com> on 2011/01/17 14:56:50 UTC

Distinguishing artifacts created on branches

Hi,

I want to deploy alternate artifacts from my branches so that other
developers can depend on them. Say, I have a product called

<groupId>com.mycompany.tool</groupId>
<artifactId>tool</artifactId>
<version>5.2-SNAPSHOT</version>

Now, I'd like to create a branch of this one where I add a new feature. And
this early adopter developer here wants to already build on my new feature,
even before I merge it back to trunk, so I deploy my artifacts to Nexus.
Now, I obviously can't deploy them under the same GAV coordinates, otherwise
they'd overwrite the ones generated from trunk. I can think of two different
options:

1) Changing the version number

<groupId>com.mycompany.tool</groupId>
<artifactId>tool</artifactId>
<version>5.2-MYBRANCH-SNAPSHOT</version>

The good thing about this is that I can use the Versions plugin to set
change the version number even in a multi-module project. The bad thing is
that whenever a release happens on trunk, or when I merge the branch back to
trunk, I get conflicts in all my POMs about the version number.

2) Changing the group ID

<groupId>com.mycompany.tool.mybranch</groupId>
<artifactId>tool</artifactId>
<version>5.2-SNAPSHOT</version>

This looks a bit better, but I can't use the versions plugin, and updating
the groupId in many places in a big multi-module project is quite
troublesome. Also, it doesn't seem correct semantically.

Do you have any advice on this?

Thanks,
Lorant

RE: Distinguishing artifacts created on branches

Posted by Lindsay Smith <li...@coretech.co.nz>.
We make extensive use of branches and including the branch in the version number is definitely the way to go.    Merging between branches does involve resolving the version number, the person in charge of merging should know what to do.

I found that the versions plugin isn't much help when you start adding the branch name in - things like 'most recent snapshot' don't take into account the current branch as maven has no knowledge of it.   

Also I have written scripts that can check that the version number matches the current (git) branch - having a plugin would be nice for this kind of thing.

Overall I think that maven kind of ignores the problem of branches of projects and doesn't really help at all in making the workflow easy.  I would love to see some kind of acknowledgement of branches in maven but I'm probably being overly optimistic.

Lindsay


> -----Original Message-----
> From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> Sent: Tuesday, 18 January 2011 3:38 a.m.
> To: users@maven.apache.org
> Subject: Re: Distinguishing artifacts created on branches
> 
> Using the branch id in the version number will make it easier to
> understand the relation between the source and the binary that it
> makes.
> If you every want to know how developer X actually got the test to work
> last month, it will be nice to be able to use the dependencies from his
> project to find a POM and the rest of the sources that match up by GAV
> and SCM branch id.
> 
> Ron
> 
> On 17/01/2011 9:02 AM, Ryan Connolly wrote:
> > Using a classifier MAY be appropriate for this use case.
> > On Jan 17, 2011 8:57 AM, "Lóránt Pintér"<lo...@gmail.com>
> wrote:
> >> Hi,
> >>
> >> I want to deploy alternate artifacts from my branches so that other
> >> developers can depend on them. Say, I have a product called
> >>
> >> <groupId>com.mycompany.tool</groupId>
> >> <artifactId>tool</artifactId>
> >> <version>5.2-SNAPSHOT</version>
> >>
> >> Now, I'd like to create a branch of this one where I add a new
> feature.
> > And
> >> this early adopter developer here wants to already build on my new
> > feature,
> >> even before I merge it back to trunk, so I deploy my artifacts to
> Nexus.
> >> Now, I obviously can't deploy them under the same GAV coordinates,
> > otherwise
> >> they'd overwrite the ones generated from trunk. I can think of two
> > different
> >> options:
> >>
> >> 1) Changing the version number
> >>
> >> <groupId>com.mycompany.tool</groupId>
> >> <artifactId>tool</artifactId>
> >> <version>5.2-MYBRANCH-SNAPSHOT</version>
> >>
> >> The good thing about this is that I can use the Versions plugin to
> set
> >> change the version number even in a multi-module project. The bad
> thing is
> >> that whenever a release happens on trunk, or when I merge the branch
> back
> > to
> >> trunk, I get conflicts in all my POMs about the version number.
> >>
> >> 2) Changing the group ID
> >>
> >> <groupId>com.mycompany.tool.mybranch</groupId>
> >> <artifactId>tool</artifactId>
> >> <version>5.2-SNAPSHOT</version>
> >>
> >> This looks a bit better, but I can't use the versions plugin, and
> updating
> >> the groupId in many places in a big multi-module project is quite
> >> troublesome. Also, it doesn't seem correct semantically.
> >>
> >> Do you have any advice on this?
> >>
> >> Thanks,
> >> Lorant
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Distinguishing artifacts created on branches

Posted by Ron Wheeler <rw...@artifact-software.com>.
Using the branch id in the version number will make it easier to 
understand the relation between the source and the binary that it makes.
If you every want to know how developer X actually got the test to work 
last month, it will be nice to be able to use the dependencies from his 
project to find a POM and the rest of the sources that match up by GAV 
and SCM branch id.

Ron

On 17/01/2011 9:02 AM, Ryan Connolly wrote:
> Using a classifier MAY be appropriate for this use case.
> On Jan 17, 2011 8:57 AM, "Lóránt Pintér"<lo...@gmail.com>  wrote:
>> Hi,
>>
>> I want to deploy alternate artifacts from my branches so that other
>> developers can depend on them. Say, I have a product called
>>
>> <groupId>com.mycompany.tool</groupId>
>> <artifactId>tool</artifactId>
>> <version>5.2-SNAPSHOT</version>
>>
>> Now, I'd like to create a branch of this one where I add a new feature.
> And
>> this early adopter developer here wants to already build on my new
> feature,
>> even before I merge it back to trunk, so I deploy my artifacts to Nexus.
>> Now, I obviously can't deploy them under the same GAV coordinates,
> otherwise
>> they'd overwrite the ones generated from trunk. I can think of two
> different
>> options:
>>
>> 1) Changing the version number
>>
>> <groupId>com.mycompany.tool</groupId>
>> <artifactId>tool</artifactId>
>> <version>5.2-MYBRANCH-SNAPSHOT</version>
>>
>> The good thing about this is that I can use the Versions plugin to set
>> change the version number even in a multi-module project. The bad thing is
>> that whenever a release happens on trunk, or when I merge the branch back
> to
>> trunk, I get conflicts in all my POMs about the version number.
>>
>> 2) Changing the group ID
>>
>> <groupId>com.mycompany.tool.mybranch</groupId>
>> <artifactId>tool</artifactId>
>> <version>5.2-SNAPSHOT</version>
>>
>> This looks a bit better, but I can't use the versions plugin, and updating
>> the groupId in many places in a big multi-module project is quite
>> troublesome. Also, it doesn't seem correct semantically.
>>
>> Do you have any advice on this?
>>
>> Thanks,
>> Lorant


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Distinguishing artifacts created on branches

Posted by Ryan Connolly <ry...@gmail.com>.
Using a classifier MAY be appropriate for this use case.
On Jan 17, 2011 8:57 AM, "Lóránt Pintér" <lo...@gmail.com> wrote:
> Hi,
>
> I want to deploy alternate artifacts from my branches so that other
> developers can depend on them. Say, I have a product called
>
> <groupId>com.mycompany.tool</groupId>
> <artifactId>tool</artifactId>
> <version>5.2-SNAPSHOT</version>
>
> Now, I'd like to create a branch of this one where I add a new feature.
And
> this early adopter developer here wants to already build on my new
feature,
> even before I merge it back to trunk, so I deploy my artifacts to Nexus.
> Now, I obviously can't deploy them under the same GAV coordinates,
otherwise
> they'd overwrite the ones generated from trunk. I can think of two
different
> options:
>
> 1) Changing the version number
>
> <groupId>com.mycompany.tool</groupId>
> <artifactId>tool</artifactId>
> <version>5.2-MYBRANCH-SNAPSHOT</version>
>
> The good thing about this is that I can use the Versions plugin to set
> change the version number even in a multi-module project. The bad thing is
> that whenever a release happens on trunk, or when I merge the branch back
to
> trunk, I get conflicts in all my POMs about the version number.
>
> 2) Changing the group ID
>
> <groupId>com.mycompany.tool.mybranch</groupId>
> <artifactId>tool</artifactId>
> <version>5.2-SNAPSHOT</version>
>
> This looks a bit better, but I can't use the versions plugin, and updating
> the groupId in many places in a big multi-module project is quite
> troublesome. Also, it doesn't seem correct semantically.
>
> Do you have any advice on this?
>
> Thanks,
> Lorant

Re: Distinguishing artifacts created on branches

Posted by Wendy Smoak <ws...@gmail.com>.
2011/1/17 Lóránt Pintér <lo...@gmail.com>:
> Now, I'd like to create a branch of this one where I add a new feature. And
> this early adopter developer here wants to already build on my new feature,
> even before I merge it back to trunk, so I deploy my artifacts to Nexus.
> Now, I obviously can't deploy them under the same GAV coordinates, otherwise
> they'd overwrite the ones generated from trunk. I can think of two different
> options:

Option 1, change the version number.

When you merge, specify a range of revision numbers.  That way you
merge only the changes, not "the state of the branch" which includes
the different version number.  (Is this Subversion or something else?)

Don't change the groupId, to Maven that makes it a totally different artifact.

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org