I have a gradle script to:
-
Build a project
-
Create a zip
-
Upload it to a Maven repository
I want to add a timestamp to the version number. After some digging around, I found that appending x.x-SNAPSHOT accomplished that for me.
The problem I’m facing at the moment is that the SNAPSHOT timestamp value is not appended to the zip file created.
Sample file that I’m using:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath “com.ullink.gradle:gradle-msbuild-plugin:1.6”
}
}
apply plugin:‘msbuild’
apply plugin: ‘maven’
project.ext {
repoUrl = “http://url/repositories”
someTextRepoUrl = project.repoUrl + “/sometext”
groupID = “somegroup”
artifactID = “artifactid”
versionNo = ‘1.0-SNAPSHOT’
}
repositories {
maven {
url project.snapshotsRepoUrl
}
}
msbuild {
// mandatory
projectFile = ‘projectFile\projectFile.csproj’
// MsBuild project name (/p:Project=…)
projectName = project.name
// Verbosity (/v:detailed, by default uses gradle logging level)
verbosity = ‘detailed’
// targets to execute (/t:Clean;Rebuild, no default)
targets = [‘Clean’, ‘Rebuild’]
}
task zipFileZip(type: Zip, dependsOn: msbuild) {
from ‘projectFile\bin\Debug’
from (‘projectFile\someFolder’) {
into(‘someFolder’)
}
}
task buildAndUploadAll(dependsOn: uploadArchives) {}
artifacts {
archives zipFileZip
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: project.someTextRepoUrl) {
authentication(userName: “xxxxxx”, password: “xxxxxxxx”)
}
pom.version = project.versionNo
pom.artifactId = project.artifactID
pom.groupId = project.groupID
}
}
}