grasshopper
grasshopper

Reputation: 4068

Gradle for multiple fatJars

I have a gradle build script that looks like this:

dependencies {
  compile project(':common:avro')
  ....

fatJar {
  manifest {
    attributes 'Main-Class': 'package.subpackage.MainClass'
  }
}

I would like to be able to choose which MainClass to use from the command line and possibly also the resulting fat.jar name. Is this possible?

Upvotes: 0

Views: 189

Answers (1)

Opal
Opal

Reputation: 84756

As stated here fatJar is a regular jar task (I assume that You're using this plugin), so You can configure it with standard DSL, search for archiveName. Should be doable.

When it comes to passing command line arguments use -P switch to pass the desired class. Then refer to it using project variable.

Upvotes: 5

Related Questions