Some clarifications about the 'application' plugin

I’m experimenting with the ‘application’ plugin and I have some questions.

First of all, my project lives in a folder named ‘foo’, but the project (as set in settings.gradle with rootProject.name) is ‘bar’. The distZip task produces a ZIP file named ‘bar.zip’, which inside has a ‘bar’ folder (redundant, in my opinion…) which in turns has a ‘lib’ folder containing a foo.jar Java archive. I would have expected it to be named bar.jar, but I had to explicitely add the following to get this result:

distributions {
    main {
        baseName = project.name
    }
}

Is this intentional?

Secondly. I need to define an extra distribution, packaging the exact same contents of the main one, but with a different main class. What I see is that:

  1. the mainClassName property is global and not a property of the main distribution scope
  2. after I define a new distribution, by default it’s empty; I guess I will be able to add the same contents of the main distribution by using a suitable CopySpec, but I fear that the previous point will prevent me from easily get the result I need

Any suggestion?

1 Like