简体   繁体   English

使用gradle而不是Eclipse构建

[英]build using gradle instead of eclipse

I'm very new to whole tomcat/spring/eclipse world. 我对整个tomcat / spring / eclipse世界非常陌生。
I used gradle a little bit for android projects. 我为Android项目使用了gradle一点。

This is a project with tomcat/spring/eclipse and I 'd like to build it with gradle. 这是一个带有tomcat / spring / eclipse的项目,我想用gradle构建它。

I copied a build.gradle file from one of tutorial on the web. 我从网络上的一个教程中复制了一个build.gradle文件。

 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' 现在我运行> gradle build ,我看到很多错误,上面写着“ org.springframework。***不存在”

I guess I need to somehow tell gradle to include *.jar files under WebContent/WEB-INF/lib directory, but don't know how. 我想我需要以某种方式告诉gradle在WebContent/WEB-INF/lib目录下包括* .jar文件,但不知道如何。

Please let me know if need to supply more info. 请让我知道是否需要提供更多信息。

To add all jar files from WebContent/WEB-INF/lib and subfolders you must include the first line: 要从WebContent/WEB-INF/lib和子文件夹添加所有jar文件,您必须包括第一行:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM