0

I am new to gradle builds. I wrote a custom service for cloudera manager which needs to build a JAR file with few directories. It is a simple archive file with few directories(descriptor, images and scripts). I created it with below jar command manually.

jar -cf CSDNAME.jar descriptor images scripts

Now I want to include this as part of gradle build for which I need to write a task. I searched online where I found java related stuff which is not required in my case. Can someone help with this?

Srikanth
  • 517
  • 3
  • 10
  • 29

1 Answers1

0

That's a code snippet using the kotlin dsl. It's based on the JAR task of the java plugin.

plugins {
    java
}    

tasks.jar {
  doFirst {
    archiveBaseName.set("CSDNAME") // By default the JAR will have the project name
    from("content") // source folder where you have your content
  }
}

N.B: If you already have a build file, you will need to change its extension to .kts, else you'll need of course to create one.

AElMehdi
  • 572
  • 4
  • 12