我正在Eclipse中运行gradle Web应用程序。我从运行“ tomcatRun”开始,超过30分钟,进程一直在运行,因为工具条刚好卡在那里。一切正常,Web应用程序在浏览器中运行良好,该应用程序很小,只有几个代码。那是正常现象吗?我是Gradle的新手。如果不正常,那怎么了?提前致谢。 以下是我的build.gradle和适合我的情况的图像。
apply plugin: 'eclipse'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
apply plugin: 'com.bmuschko.tomcat'
dependencies {
compile "org.springframework:spring-webmvc:$springVersion"
compile "org.springframework:spring-jdbc:$springVersion"
compile "com.h2database:h2:$h2Version"
compile "org.hibernate:hibernate-validator:$hibernateValidatorVersion"
compile "org.apache.commons:commons-lang3:$commonsLangVersion"
compile "org.thymeleaf:thymeleaf-spring3:$thymeleafVersion"
compile 'org.slf4j:slf4j-api:1.7.12'
providedCompile "javax.servlet:javax.servlet-api:$servletApiVersion"
testCompile "junit:junit-dep:$junitVersion"
testCompile "org.springframework:spring-test:$springVersion"
testCompile "org.mockito:mockito-core:$mockitoVersion"
testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
}
repositories {
maven { url 'http://maven.springframework.org/release' }
maven { url 'http://maven.springframework.org/milestone' }
maven { url 'http://maven.springframework.org/snapshot' }
maven { url 'http://download.java.net/maven/2' }
mavenCentral()
}
dependencies {
def tomcatVersion = '7.0.59'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:$tomcatVersion",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:$tomcatVersion",
"org.apache.tomcat.embed:tomcat-embed-jasper:$tomcatVersion"
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.bmuschko:gradle-tomcat-plugin:2.2.2'
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.6'
}
我刚刚通过运行“ gradle tomcatRun --debug”找到了问题 报告:
00:10:06.439 [DEBUG] [org.apache.catalina.loader.WebappClassLoaderBase] modified()
00:10:06.439 [DEBUG] [org.apache.catalina.loader.WebappClassLoaderBase] Failed tracking modifications of '/WEB-INF/lib'
我刚刚阅读了一篇有关tomcat WebAppClassLoader源代码分析的博客,其中说tomcat扫描每10秒修改一次。所以我认为这只是正常现象。仍然很奇怪为什么它不能在后台运行?而且tomcatStop命令无法终止此tomcatRun进程。
这是我的理论。如果我错了,请提醒我,并清除我的疑问。
谢谢!