eugene
eugene

Reputation: 41685

build using gradle instead of eclipse

I'm very new to whole tomcat/spring/eclipse world.
I used gradle a little bit for android projects.

This is a project with tomcat/spring/eclipse and I 'd like to build it with gradle.

I copied a build.gradle file from one of tutorial on the web.

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

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

 jar {
     baseName = 'gs-serving-web-content'
     version =  '0.1.0'
 }

 repositories {
     mavenCentral()
 }

 sourceCompatibility = 1.7
 targetCompatibility = 1.7

 dependencies {
     compile("org.springframework.boot:spring-boot-starter-thymeleaf")
     testCompile("junit:junit")
 }

 task wrapper(type: Wrapper) {
     gradleVersion = '2.3'
 }

Now I run > gradle build and I see tons of errors which says 'org.springframework.*** does not exist'

I guess I need to somehow tell gradle to include *.jar files under WebContent/WEB-INF/lib directory, but don't know how.

Please let me know if need to supply more info.

Upvotes: 1

Views: 128

Answers (1)

Cwt
Cwt

Reputation: 8576

To add all jar files from WebContent/WEB-INF/lib and subfolders you must include the first line:

 dependencies {
     compile(fileTree(dir: "WebContent/WEB-INF/lib", include: "**/*.jar"))
     compile("org.springframework.boot:spring-boot-starter-thymeleaf")
     testCompile("junit:junit")
 }

Upvotes: 1

Related Questions