Comments (6)
Currently this features is not implemented but you could try to achieve something similar by playing with versionPatterns
property of release
convention object.
The property allows you to configure matcher and closure that is updating the version.
By default closure increases latest version number, but you can try to configure to substitute hash of git commit instead.
Although this approach won't let you get rid of SNAPSHOT
prefix it probably could fit your needs.
from gradle-release.
Evgeny is correct. This is not really possible in this plugin at this time. He's correct, you might be able to play with the versionPatterns to get what you want, but I suspect that would be pretty difficult.
I'm not sure this is actually a good feature for this plugin though, because it's intended to do releases, not really snapshot/dev builds. The concepts are different in Maven as well. There's the Maven Release plugin and then the deployment plugin. To deploy snapshots you use 'mvn deploy', you don't do the 'mvn release:perform' operation. I think it would be better to have a separate task for what you're asking for. Maybe another gradle plugin that allows you to define a snapshot scheme, much like we do here with the versionPatterns.
from gradle-release.
I'll give the fiddling with the versionPattern a try. Thanks for the pointer
I do think this kind of stuff belongs in a release plugin. I don't really see a difference between releasing
4.3.2
of a project versus 4.3.2-RC3
or 4.3.2-NIGHTLY-build9347
It just differs in the degree of 'completeness' of the code&qa process. If you use completely different plugins for those, how would you be sure that they are actually the same.
from gradle-release.
I don't really see those things as the same as a SNAPSHOT build, which is what you asked about originally. What you've described just above are what I'd consider singular and different versions. Snapshot builds are masked versions that don't have tags associated with them.
Eg. You specify the version as 1.0-SNAPSHOT, maven uploads 1.0-12345678998765432131, but you specify the dependency version as 1.0-SNAPSHOT. Maven figures out which artifact to actually download. When you do a mvn deploy, no VCS tag is created for that.
I think this is what makes them different. To me, this would be like continuously recreating a tag for version 1.0-SNAPSHOT. It's different each time you do a build, but you're telling people they're the same thing.
This plugin can already support the 3 version schemes you mentioned above. This plugin does pre releases for it's dev versions - and tags are created for those. At work we have a version scheme of major.minor.patch.build, so we have a Jenkins job that creates 1.0.0.1, and 1.0.0.2 builds on a nightly basis. This plugin supports this out of the box as well. To get Git revision from within your CI might not be too hard, although it would be a little redundant because the plugin is going to create a tag for that revision.
That being said, I know Jenkins provides System variables for things like this, so you might be able to do a version pattern similar to this:
/(\d+)([^\d]*$)/: { Matcher m ->
m.group() + "-" + System.env["GIT_COMMIT"]
}
But, as I mentioned you're likely going to have a tag that looks like "1.0-GIT_COMMIT" where GIT_COMMIT is the same sha as the tag itself.
NOTE: that this won't work as a SNAPSHOT dependency, your other projects would have to specify the exact sha to get maven or gradle to download it as a dependency.
from gradle-release.
Sorry, for not being clear about my intend. I'll try the version pattern.
This is for a distribution (a complete java app as zip file) so I don't care if this is considered a Snapshot build or not by other tools.
from gradle-release.
I'll create a ticket to add the Project object to the versionPatterns, that should make it a little easier to do these things.. That way you'll have access to the full version value as well the conventions and properties.
from gradle-release.
Related Issues (20)
- Leading space inserted for title of pre tag commit HOT 3
- "Extension with name 'release' does not exist" for 3.0.0, Gradle 7.5 and multiproject HOT 1
- Build failing after upgrading to 3.0.0 HOT 3
- Release with protected branch HOT 1
- Update citation files on version change
- Ignoring requireBranch is not possible HOT 4
- Define Release Branch name Template
- 3.0.0 - buildTasks default changed from ['build'] to [] HOT 1
- Releasing doesn't remove "snapshot" from the jar names HOT 4
- :submodule:release stuck at unSnapshotVersion
- Cannot trigger task after release HOT 1
- release does not build HOT 1
- Question: Behavior of plugin while preparing new version commit
- Gradle 9.0: The StartParameter.settingsFile property has been deprecated. HOT 16
- Use updateVersion with args HOT 1
- I have a new idea to incorporate this feature into the plugin for the purpose of using dynamic version dependencies
- Composite build not supported HOT 2
- Failure on releasing jni projects
- Unable to configure releases with protected main branch in Gradle HOT 1
- Failure with Gitlab 16.8.1 (No user exists for uid 503) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gradle-release.