Abs*_*Abs 0 tomcat build spring-mvc intellij-idea gradle
我试图在Spring中运行示例应用程序(第4版),但无法在build.gradle脚本中配置tomcat,我尝试将tomcat插件添加到脚本中
apply plugin: 'war'
apply plugin: 'idea'
**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 "javax.servlet:jstl:$jstlVersion"
providedCompile "javax.servlet:javax.servlet-api:$servletApiVersion"
providedCompile "javax.servlet.jsp:jsp-api:$jspApiVersion"
providedCompile "javax.el:javax.el-api:$jspElVersion"
**classpath 'com.bmuschko:gradle-tomcat-plugin:2.2.2'**
**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}"**
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()
**jcenter()**
}
task wrapper(type: Wrapper) {
gradleVersion = '2.1'
}
war {
baseName = 'spittr'
}
Run Code Online (Sandbox Code Playgroud)
但它总是失败构建给出错误:
Plugin with id 'com.bmuschko.tomcat' not found.
Run Code Online (Sandbox Code Playgroud)
我已经在**中封装了我用于tomcat配置的设置.
阅读该插件的文档,您需要在buildscriptgradle构建部分中指定依赖项和存储库- 这将在主构建脚本之前加载/构建.
删除当前在文件中包含它们的插件和存储库,并尝试将整个代码块添加到gradle的顶部:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.bmuschko:gradle-tomcat-plugin:2.2.2'
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4331 次 |
| 最近记录: |