【问题标题】:build using gradle instead of eclipse使用 gradle 而不是 eclipse 构建
【发布时间】:2015-09-07 15:48:49
【问题描述】:

我对整个 tomcat/spring/eclipse 世界都很陌生。
我在 android 项目中使用了一点 gradle。

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

我从网上的一个教程中复制了一个 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 目录,但不知道如何。

如果需要提供更多信息,请告诉我。

【问题讨论】:

    标签: java eclipse spring gradle


    【解决方案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")
     }
    

    【讨论】:

      猜你喜欢
      • 2015-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-29
      • 1970-01-01
      • 1970-01-01
      • 2013-07-04
      相关资源
      最近更新 更多