spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.16k stars 40.68k forks source link

Gradle generates different Uber jar than Maven #6135

Closed tpalarz closed 8 years ago

tpalarz commented 8 years ago

I originally filed this with Spring Framework before learning about issue tracking on github for Boot. Original ticket: https://jira.spring.io/browse/SPR-14348 .

The details are as follows:

Hi, I've been building simple web services using Spring Boot with both the Maven and Gradle plugins and I'm seeing differences between the two. I am working with Spring Boot 1.3.5.RELEASE . The primary difference is that the gradle plugin does not appear to create a jar in the format from the reference doc: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#executable-jar . There is no BOOT-INF folder in the jar created and the META-INF/MANIFEST.MF doesn't have entries for "Spring-Boot-Classes" or "Spring-Boot-Libs" like the the file would if it were generated by the maven plugin.

I'm using gradle version 2.13 and Java jdk 8.

My build.gradle is as follows:

buildscript {
    repositories { 
      mavenCentral() 
    }
    dependencies { 
      classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.5.RELEASE") 
    }
}

apply plugin: 'java'
apply plugin: 'spring-boot'

jar { 
  baseName = 'test-app' version = '0.1.0' 
}

repositories { 
  mavenCentral() 
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies { 
  compile("org.springframework.boot:spring-boot-starter-web") 
}

task wrapper(type: Wrapper) { 
  gradleVersion = '2.3' 
}
philwebb commented 8 years ago

The BOOT-INF folder and Spring-Boot-Classes, Spring-Boot-Libs manifest entries are coming in version 1.4. If you're using 1.3 you won't see them. You should still have a nested /lib folder and a Start-Class entry in your MANIFEST.MF.

Are you using the same Spring Boot version for both your Maven and Gradle builds?

tpalarz commented 8 years ago

Thanks. I was in fact using different versions of maven and gradle and using 1.4.0 SNAPSHOT release w/ gradle does give me the BOOT-INF. Thanks so much!