0

I'm using gradle 7.2 with the java, application, and distribution plugins. In my gradle.build, is a section for statupScripts:

tasks.withType(CreateStartScripts) {
  def tplName = 'unixStartScriptTemplate.txt'
  assert project.file(tplName).exists()
  unixStartScriptGenerator.template = resources.text.fromFile(tplName)
}

The same template will be applied to all distributions.

distributions {
  distroA {
        ...
  }
  distroB {
        ...
  }
}

Can someone help with having gradle generate startup scripts based on the distributions. I would like to have a template for distroA and a slightly different template for distroB

Thanks

The desired output would be a .tar and .zip generated for each distribution, where the startup scripts for each distribution could be tailored / different for that distribution.

hrfici
  • 3
  • 2

1 Answers1

0

By default there is only the main distribution and the application plugin is the one that creates one CreateStartScripts task and configures the main distribution to package it.

So if you have additional distributions that all are also getting the start scripts, you most probably configured that yourself. So just do not use the CreateStartScripts task that was created by the application plugin, but define own tasks of that type with the templates you want to have and package them into your distributions instead of the one added by the application plugin.

Vampire
  • 35,631
  • 4
  • 76
  • 102
  • Thank you for the response/answer. Looking a bit deeper, seems like a cascade of several issues to get the different scripts into the proper distribution/build. I'm taking a simpler approach to just add a task to generate my alternate scripts and manually update the distribution files post build. Thank You. – hrfici Jun 28 '23 at 17:51
  • You're welcome. Please also consider following https://stackoverflow.com/help/someone-answers :-) – Vampire Jun 28 '23 at 18:23