Skip to content

gradle plugin: create zip and tar distributions with fat runnable jar  #2622

Closed

Description

@houbie

When using fat runnable jars, it makes sense to have them also in the zip and tar distributions.
I tried to achieve this by adapting the distribution content, but that doesn't work because the bootRepackage task depends on the distributions tasks.
Is there a reason for this task dependency (I would expect the reverse dependency)?

Activity

  1. philwebb commented on Mar 10, 2015

    @philwebb
    Member

    I can't recall a specific reason for the distribution dependencies, it might have just been the easiest way to get the repackage task to run at the appropriate time.

    Do you have an example gradle file that you could provide to show how tar/zip distributions are typically created?

  2. added
    type: enhancement
    on Mar 10, 2015
  3. added this to the 1.3.0 milestone on Mar 10, 2015
  4. houbie commented on Mar 10, 2015

    @houbie
    Author

    The distZip and distTar tasks come with the gradle application plugin (added by spring boot plugin).
    See http://gradle.org/docs/current/userguide/application_plugin.html , section 45.4

    I currently work around this issue with new tasks that overwrite the zip and tar distros:

    def distributionsCopySpec = copySpec {
        into("$name-$version") {
            into('lib') {
                from libsDir
                include '*.jar' //copy the fat jar created by bootRepackage
            }
            from 'README.md'
            into('bin') {
                from 'bin' //custom start script based on startScripts task output
            }
        }
    }
    
    task fatJarZip(type: Zip, dependsOn: 'bootRepackage') { with distributionsCopySpec }
    task fatJarTar(type: Tar, dependsOn: 'bootRepackage') { with distributionsCopySpec }
    
    uploadArchives.dependsOn(fatJarZip, fatJarTar)

    If the dist tasks could depend on the bootRepackage task, this would be a bit easier and it would make sense to have this as default behavior.

  5. modified the milestones: 1.4.0, 1.3.0.RC1 on Jul 10, 2015
  6. modified the milestones: 1.4.0.M2, 1.4.0 on Jan 7, 2016
  7. btiernay commented on Apr 9, 2016

    @btiernay

    This would be a great addition. Having some serious headaches with Spring Boot and distTar right now due to #2679.

  8. modified the milestones: 1.4.0.M2, 1.4.0.M3 on Apr 12, 2016
  9. self-assigned this
    on Apr 15, 2016
  10. added
    for: team-attention
    on Apr 19, 2016
  11. 13 remaining items

  12. modified the milestones: 2.0.0.M2, 2.0.0.M3 on Jan 12, 2017
  13. modified the milestones: 2.0.0.M3, 2.0.0.M2 on Feb 8, 2017
  14. modified the milestones: 2.0.0.M2, 2.0.0.M1 on Feb 15, 2017
  15. self-assigned this
    on Feb 15, 2017
  16. added a commit that references this issue on Apr 3, 2017
    5bc3889
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions