[英]Class in main/resources not found
I'm using the Spring Boot gradle plugin to build an executable war. 我正在使用Spring Boot gradle插件来构建可执行文件。 I have a FindResource.java class in src/main/resources to locate files:
我在src / main / resources中有一个FindResource.java类来查找文件:
FindResource.class.getResource(templateName).toURI()
When I execute gradle build I get an error, that the class FindResource cannot be resolved. 当我执行gradle build时,我得到一个错误,该类FindResource无法解析。 Do I need to the the Spring Boot gradle plugin, that it should also use classes from the resources directory.
我需要Spring Boot gradle插件吗,它还应该使用resources目录中的类。 How can I do so?
我该怎么办?
My build.gradle looks as follows: 我的build.gradle如下所示:
buildscript {
ext {
springBootVersion = '1.2.5.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("io.spring.gradle:dependency-management-plugin:0.5.2.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
apply plugin: 'io.spring.dependency-management'
jar {
baseName = 'abc'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.springframework.boot:spring-boot-starter-jersey")
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.apache.pdfbox:pdfbox:1.8.10")
compile('org.apache.poi:poi-ooxml:3.12')
compile('org.apache.poi:poi-scratchpad:3.12')
runtime("org.hsqldb:hsqldb")
testCompile("org.springframework.boot:spring-boot-starter-test")
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.