Manish
Manish

Reputation: 3968

Gradle: unpack war, apply customizations and repackage war

I have a third party packaged war published in artifactory. I need to create a gradle job that will grab the war from artifactory, explode it to a temporary directory, add some custom libraries(jars) to the WAR file and then repackage and publish it to another location in artifactory.

I am looking for suggestions on:

  1. how can I fetch a artifact from artifactory in gradle and explode it to temporary directory?

I have seen the gradle WAR plugin documentation and it seems we can specify a custom location from which the WAR should be repackaged.

Upvotes: 2

Views: 2638

Answers (1)

RaGe
RaGe

Reputation: 23657

Partial answer: Add the artifactory artifact as a dependency to your gradle.build - which will fetch the artifact and cache it in gradle cache.

task unpack(type: Copy) {

  def archivePath = project.configurations.compile.find{it.name.startsWith("something") }
  def archiveFile = file(archivePath )
  def outputDir = file("${buildDir}/unpacked/dist")

  from zipTree(zipFile)
  into outputDir
}

Upvotes: 1

Related Questions