SNAPSHOT for zip files


(Meera Viswanathan) #1

I have a gradle script to:

  1. Build a project 2) Create a zip 3) 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.


(Peter Niederwieser) #2

In order to help, we would need more information, ideally a self-contained build script that demonstrates the issue.


(Meera Viswanathan) #3

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

}

} }