【发布时间】:2018-04-04 02:44:55
【问题描述】:
我有一个 SpringBoot 应用程序,其中包含几个 JSP 页面。当我从 Eclipse 启动主类时,它运行良好。但同时我打包成jar的时候,WEB-INF/jsp文件夹配置不正确。我被困在这里。请求您的帮助
下面是我的 Gradle 脚本
buildscript {
ext {
springBootVersion = '1.5.4.RELEASE'
}
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
group = 'com.arun'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
task packSSO(type: Jar) {
manifest {
attributes(
'Implementation-Title': 'Arun Spring Boot Application',
'Implementation-Version': version,
'Built-By': System.getProperty('user.name'),
'Built-Date': new Date(),
'Main-Class': 'com.arun.MainGate',
'Built-JDK': System.getProperty('java.version')
)
}
sourceSets {
main {
resources {
srcDirs "src/main/resources"
}
}
}
baseName = project.name + '-all'
from {
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
}
with jar
}
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-tomcat')
compile('org.apache.tomcat.embed:tomcat-embed-jasper')
compile ('javax.servlet:jstl:1.2')
testCompile('org.springframework.boot:spring-boot-starter-test')
testImplementation 'junit:junit:4.12'
}
我分解了创建的 Jar,结构如下所示。
所以当我运行java -jar SSOPage-0.0.1-SNAPSHOT.jar 时,它找不到JSP 页面。我应该遵循什么确切的文件夹结构以及如何将WEB-INF 打包到 gradle 中?
【问题讨论】:
标签: spring-boot gradle build.gradle