Hi Matt, Thanks for the pointer to the release plugin. My desire is to not control the process of making branches or changing versions through plugins. I want developers to be able to use git for things branch related, and use maven for compile/build related.
I think the release-plugin is trying to do too much (unless of course you want maven to do *everything* :) ) Regardless of my opinion, though, you are a big help. I'll still try to find the route I'm trying to take... Seth On Wed, Mar 7, 2012 at 10:03 AM, walshmatt [via Maven] < ml-node+s40175n5544568...@n5.nabble.com> wrote: > Seth. > > I tried doing something similar to this using the > buildnumber-maven-plugin. It returns the branch and revision number (I > use Subversion, not Git), but looks like you're trying something > similar. > > The problem I encountered (at least how I interpreted it) is that the > plugin doesn't run soon enough - the pom has already been interpreted > before the plugin is called, so the ${branch} wasn't resolved when I > needed it. I wasn't trying to change the version, but I was trying to > use the property somewhere else. I think you'd have the same issue with > version though. > > You can use the maven-release-plugin to create your branch. It prompts > for a new version and updates and commits your poms automatically (at > least for SVN). When/if you merge your changes back to the master > branch, you'd probably need to update your versions again, but that can > be accomplished with the versions plugin. > > HTH, > Matt > > > -----Original Message----- > > From: Seth Call [mailto:[hidden > > email]<http://user/SendEmail.jtp?type=node&node=5544568&i=0>] > > > Sent: Wednesday, March 07, 2012 8:19 AM > > To: [hidden email]<http://user/SendEmail.jtp?type=node&node=5544568&i=1> > > Subject: Re: Is it possible to tie current git branch to project > > version? > > > > Hi Roy, > > > > I don't understand what 'tagging our repo' means. Is this a feature > of > > > your remote repository? Sorry... I googled but I don't know what you > > are > > saying... > > > > But aside from that, I really don't care about git hash in this > > question... > > let me explain what I'm trying to acheive... > > > > > > > > As a developer: > > * If I'm on branch master, I want my project version to be master- > > SNAPSHOT > > > > * If I'm on branch development, I want my project version to be > > development-SNAPSHOT > > > > I'd like that to happen automatically when I make the branch; I know > > this > > is rather dynamic so I assume a plugin at a minimum is required. I'm > > also > > not interested in using git local hooks if at all avoidable because > > they > > have their own drawbacks. > > > > This versioning scheme is very important; making a branch is making a > > new > > version. So, downstream projects that depend on my project:master- > > SNAPSHOT > > should *not* pickup my new branch's build artifact-not unless, of > > course, I > > go to that downstream project and change it's dependency version to > say > > project:development-SNAPSHOT. > > > > In summary, they are different versions, and so if you don't version > > your > > project as you make a branch, then you will now have indeterminate > > build > > resolution because 'the-last-branch-you-build-will-win' sort of > > problems. > > Also, all of this should work locally (not require a build server), > so > > > I'm > > limiting myself to maven-only techniques... > > > > Any help is greatly appreciated. I hope there is some way to achieve > > this > > that I'm just not thinking of... > > > > But if anyone can say definitively that you can not put a variable in > > the > > <version> tag of an artifact, then I at least know a plugin-based > > solution > > is not an option. > > > > Regards, > > Seth > > > > On Wed, Mar 7, 2012 at 6:00 AM, Lyons, Roy [via Maven] < > > [hidden email] <http://user/SendEmail.jtp?type=node&node=5544568&i=2>> > wrote: > > > > > :-) we tag our repo with "branchname!RP-BL-mavenlabel" to help in > > > location. Rp is for release prepare and bl is for baseline > > (carryover from > > > clearcase terminology) > > > > > > Just remember that in git a hash doesn't belong to a branch, it is > > simply > > > attached to a linked list of hashes. A "branch" is simply a tag > > pointing > > > to a hash being designated as a "head". You can just as easily use > > the tag > > > created by the release plugin to checkout, and then make some bugfix > > branch > > > from that location. > > > > > > > > > Sent from my Blackberry. > > > > > > ----- Original Message ----- > > > From: Seth Call <[hidden > > email]<http://user/SendEmail.jtp?type=node&node=5543915&i=0>> > > > > > > To: [hidden email] > > <http://user/SendEmail.jtp?type=node&node=5543915&i=1><[hidden > > > email] <http://user/SendEmail.jtp?type=node&node=5543915&i=2>> > > > Sent: Tue Mar 06 22:01:07 2012 > > > Subject: Is it possible to tie current git branch to project > version? > > > > > > > Hi there, > > > > > > I've seen indication when searching the internet that it isn't > > possible to > > > put variables in <version> of a project (unless those variables are > > > hardcoded <properties> or provided at the command line), but I > > thought I'd > > > ask the list ... > > > > > > Say there was a plugin that would invoke 'git branch' to determine > > the > > > current branch, and to then make that available to the project as a > > > variable; call it ${branch}. I'd like to use this variable then in > > the > > > version tag: > > > > > > <project> > > > <groupId>blah</groupId> > > > <artifactId>blah</artifactId> > > > <version>${branch}-SNAPSHOT</version> > > > </project> > > > > > > The reason I want to do this is that I'm realizing, for our > internal- > > only > > > code projects, that a branch is always synonymous with a version of > a > > > > project, and ideally the act of being of switching branches would be > > all > > > it > > > takes to switch your maven project's version. > > > > > > Is this possible if I were to make a maven plugin? > > > > > > Thanks! > > > Seth > > > > > > > > > > > > > > > -- > > > View this message in context: > > > http://maven.40175.n5.nabble.com/Is-it-possible-to-tie-current-git- > > branch-to-project-version-tp5543110p5543110.html > > > Sent from the Maven - Users mailing list archive at Nabble.com. > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [hidden > > email]<http://user/SendEmail.jtp?type=node&node=5543915&i=3> > > > For additional commands, e-mail: [hidden > > email]<http://user/SendEmail.jtp?type=node&node=5543915&i=4> > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: [hidden > > email]<http://user/SendEmail.jtp?type=node&node=5543915&i=5> > > > For additional commands, e-mail: [hidden > > email]<http://user/SendEmail.jtp?type=node&node=5543915&i=6> > > > > > > > > > ------------------------------ > > > If you reply to this email, your message will be added to the > > discussion > > > below: > > > > > > http://maven.40175.n5.nabble.com/Is-it-possible-to-tie-current-git- > > branch-to-project-version-tp5543110p5543915.html > > > To unsubscribe from Is it possible to tie current git branch to > > project > > > version?, click > > > here<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=un > > > subscribe_by_code&node=5543110&code=c2V0aGNhbGxAZ21haWwuY29tfDU1NDMxMTB > > 8LTU5NTg4MjI5Nw==> > > > . > > > > > > NAML<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=ma > > > cro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.names > > paces.BasicNamespace-nabble.view.web.template.NabbleNamespace- > > > nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%2 > > > 1nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml- > > send_instant_email%21nabble%3Aemail.naml> > > > > > > > > > -- > > View this message in context: http://maven.40175.n5.nabble.com/Is-it- > > possible-to-tie-current-git-branch-to-project-version- > > tp5543110p5544417.html > > Sent from the Maven - Users mailing list archive at Nabble.com. > > ______________________________________________________________________ > This message, including any attachments, is confidential and contains > information intended only for the person(s) named above. Any other > distribution, copying or disclosure is strictly prohibited. If you are not > the intended recipient or have received this message in error, please > notify us immediately by reply email and permanently delete the original > transmission from all of your systems and hard drives, including any > attachments, without making a copy. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=5544568&i=3> > For additional commands, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=5544568&i=4> > > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://maven.40175.n5.nabble.com/Is-it-possible-to-tie-current-git-branch-to-project-version-tp5543110p5544568.html > To unsubscribe from Is it possible to tie current git branch to project > version?, click > here<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5543110&code=c2V0aGNhbGxAZ21haWwuY29tfDU1NDMxMTB8LTU5NTg4MjI5Nw==> > . > NAML<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://maven.40175.n5.nabble.com/Is-it-possible-to-tie-current-git-branch-to-project-version-tp5543110p5545345.html Sent from the Maven - Users mailing list archive at Nabble.com.