我正在使用Gradle 5.1.1和Intellij Idea 2018.3.5编写带有Web Flow的Pro Spring MVC书的示例代码
但是在父项目的build.gradle中,出现以下错误:
无法获得类型为org.gradle.api.Project的根项目'prospringmvc'的未知属性'Compile'
这是build.gradle文件:
apply plugin: 'base'
ext.springVersion = '3.2.3.RELEASE'
ext.tilesVersion = '2.2.2'
ext.springSecurityVersion = '3.1.4.RELEASE'
ext.springSwfVersion = '2.3.2.RELEASE'
ext.hibernateVersion = '4.2.3.Final'
ext.hibernateValidatorVersion = '5.0.1.Final'
ext.ehCacheVersion = '2.7.2'
ext.aspectJVersion = '1.7.3'
ext.tomcatVersion = '7.0.42'
ext.cargoVersion = '1.3.3'
ext.webProjects = subprojects.findAll { project -> project.name.endsWith('bookstore') }
buildscript {
repositories {
maven { url 'http://jcenter.bintray.com/' }
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:1.2.4'
classpath 'org.gradle.api.plugins:gradle-cargo-plugin:1.5'
}
}
allprojects {
description = 'Bookstore Sample Application'
group = 'com.apress.prospringmvc'
version = '1.0.0'
repositories {
maven{
url 'http://maven.springframework.org/release'
}
maven{
url 'http://maven.springframework.org/snapshot'
}
mavenCentral()
maven{
url 'http://maven.springframework.org/milestone'
}
maven{
url 'https://repository.jboss.org/nexus/content/repositories/releases/'
}
maven{
url 'http://download.java.net/maven/glassfish/org/glassfish/'
}
// mavenRepo url: 'http://maven.springframework.org/release'
// mavenRepo url: 'http://maven.springframework.org/snapshot'
// mavenCentral()
// mavenRepo url: 'http://maven.springframework.org/milestone'
// mavenRepo url: 'https://repository.jboss.org/nexus/content/repositories/releases/'
// mavenRepo url: 'http://download.java.net/maven/glassfish/org/glassfish/'
}
tasks.withType(Compile) {
options.compilerArgs << "-g"
}
}
configure(webProjects) {
apply plugin: 'war'
apply plugin: 'jetty'
apply plugin: 'tomcat'
apply plugin: 'cargo'
dependencies() {
compile project(':bookstore-shared'), project(':bookstore-web-resources')
compile "org.apache.tiles:tiles-servlet:$tilesVersion"
compile "org.apache.tiles:tiles-jsp:$tilesVersion"
compile "org.apache.tiles:tiles-api:$tilesVersion"
compile "org.apache.tiles:tiles-core:$tilesVersion"
runtime "jstl:jstl:1.2"
providedCompile 'javax.servlet:javax.servlet-api:3.0.1'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}"
tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'
cargo "org.codehaus.cargo:cargo-core-uberjar:${cargoVersion}",
"org.codehaus.cargo:cargo-ant:${cargoVersion}"
}
}
cargo {
containerId = 'tomcat7x'
port = 8080
local {
homeDir = file('container/apache-tomcat-7.0.42')
output = file('container/apache-tomcat-7.0.42/output.log')
}
}
war {
version = '' //We do this to make the wars versionless, when they are deployed with cargo, the context
//root of the app is equal to the file name, which is equal to the sample directory name.
}
task systemTest(type: Test) {
include '**/*FrontendTest.*'
dependsOn(war)
doFirst {
cargoStartLocal.execute()
}
}
test {
exclude '**/*FrontendTest.*'
}
}
subprojects() {
apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'idea'
sourceCompatibility = 1.7
targetCompatibility = 1.7
dependencies() {
compile "org.springframework:spring-orm:$springVersion"
compile "org.springframework:spring-aop:$springVersion"
compile "org.springframework:spring-webmvc:$springVersion"
compile "org.springframework:spring-oxm:$springVersion"
compile 'org.slf4j:jcl-over-slf4j:1.7.2'
compile 'ch.qos.logback:logback-classic:1.0.9'
compile 'org.apache.commons:commons-lang3:3.0.1'
compile 'com.thoughtworks.xstream:xstream:1.4.2'
compile 'com.h2database:h2:1.3.168'
compile 'cglib:cglib-nodep:2.2.2'
compile "org.aspectj:aspectjrt:$aspectJVersion"
compile "org.aspectj:aspectjweaver:$aspectJVersion"
compile "org.hibernate:hibernate-entitymanager:$hibernateVersion"
compile "org.hibernate:hibernate-core:$hibernateVersion"
compile "org.hibernate:hibernate-ehcache:$hibernateVersion"
compile "org.hibernate:hibernate-validator:$hibernateValidatorVersion"
compile "net.sf.ehcache:ehcache:$ehCacheVersion"
compile 'com.lowagie:itext:2.1.7'
compile 'net.sourceforge.jexcelapi:jxl:2.6.12'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.11'
compile 'commons-codec:commons-codec:1.6'
compile 'joda-time:joda-time:2.1'
testCompile 'junit:junit:4.11'
testCompile "org.springframework:spring-test:$springVersion"
}
eclipse {
project.natures "org.springframework.ide.eclipse.core.springnature"
}
}
task wrapper(type: Wrapper) { gradleVersion = '1.6' }