Versioning with NPanday and Maven Release Plugin
I'm working on a C# .NET webservices project that uses Maven with NPanday. We also want to use the release plugin, but I've found a minor versioning issue.
NPanday will (conveniently) update the AssemblyInfo.cs
file with the version number from the POM file when you do a build, but it doesn't commit to that change to SVN (nor would I necessarily want it to).
The release plugin doesn't know about AssemblyInfo.cs
(nor would I expect it to). But this means that my AssemblyInfo.cs and POM versions get out of sync during release operations.
For example, say I do mvn release:branch
to create a 2.0.x branch from trunk. The POM and AssemblyInfo.cs
were probably both at 2.0.0-SNAPSHOT in the trunk prior to branching, so the branch looks as I would expect. But in the updated trunk, the POM version has been updated (e.g. 2.1.0-SNAPSHOT) but the AssemblyInfo.cs is still at 2.0.0-SNAPSHOT.
This isn't a huge problem because the next mvn compile
on the trunk will update the AssemblyInfo.cs
and someone will commit it. But it's worse with release:prepare
because the tag created from the branch has the correct version in the POM (e.g. 2.0.0), but the AssemblyInfo.cs
still says -SNAPSHOT. When release:perf开发者_开发问答orm is run, NPanday will update the AssemblyInfo.cs
file, but then there's a floating modification from that tag.
Does anyone know of a way to rectify this with the release plugin? I could certainly create correct branches/tags by hand or code up a custom tool. Or I could just leave it as is, saying that "The AssemblyInfo.cs file isn't the definitive version source, the POM is." But I'd prefer the best of both worlds.
I'd let NPanday generate the AssemblyInfo.cs for you - then you avoid checking in things with versions in it...
Visual Studio will work fine without assembly infos... Version is 0.0.0.0, then :-) - I'm doing it that way.
Actually NPanday is "breaking" the maven rules - a build should never fiddle with the original files, but rather just update things in /target...
精彩评论