2015-09-07 61 views
1

我对整个tomcat/spring/eclipse世界都很陌生。
我对Android项目使用了gradle。使用gradle而不是eclipse构建

这是一个tomcat/spring/eclipse的项目,我想用gradle构建它。

我从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' 
} 

现在我跑> gradle build,我看到吨它说的错误“org.springframework。***不存在”

我想我需要以某种方式告诉gradle这个包括在* .jar文件 WebContent/WEB-INF/lib目录,但不知道如何。

如果需要提供更多信息,请让我知道。

回答

1

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") 
}