Problems with Zip task


(Sigmund Lundgren) #1

I’m trying to use the zip task in my custom plugin. The plugin uses an extension to configure the ‘from’ directory of the zip task to determine what to zip (path). Problem is that the extension property is not set when running the Zip task. Maybe wrong phase? Can’t get it to work. Any suggestions?

project.task(‘archiveFabric8Profile’, type: Zip, dependsOn: ‘createFabric8AgentProperties’) {

doLast {

def profileDir = project.buildDir.path + “/” + PluginUtil.parseProfilenameIntoPath(project.fabric8.profile)

from profileDir

}

}


(Peter Niederwieser) #2

Plugins have to defer all access to user-configurable build information until at least the end of the configuration phase. However, ‘doLast’ is too late (that’s effectively after the task has executed). In the present case, you can just use ‘from { profileDir }’.


(Sigmund Lundgren) #3

think I tried that, will check again. Did a workaround by packaging all to zip into build/generated.