找不到参数的方法compile() [英] could not find method compile() for arguments
问题描述
我试图执行一些 .sql
脚本,然后使用 gradle tomcat插件
来部署web应用程序。
但是,当我尝试运行 gradle
时出现错误
My buildscript
看起来像这样
buildscript {
//存储库位置
存储库{
mavenCentral()
jcenter()
}
//依赖关系
//不会将它们分为运行时和编译
依赖关系{
// aspectJ依赖关系
编译'org.aspectj:aspectjlib:1.6.2'
编译'org.aspectj:aspectjrt:1.7.4'
编译'org.aspectj:aspectjweaver:1.7.4'
// servlet
编译'javax.servlet:javax.servlet-api:3.0.1'
// jdbc postresql
编译'org.postgresql:postgresql:9.2-1004-jdbc4'
// commons dbcp
编译'commons-dbcp:commons-dbcp:1.2.2'
// spring& Spring MVC依赖
compile'org.springframework:spring-core:'+ spring_version
compile'org.springframework:spring-web:'+ spring_version
compile'org.springframework:spring-webmvc :'+ spring_version
compile'org.springframework:spring-jdbc:'+ spring_version
compile'org.springframework:spring-aspects:'+ spring_version
// spring security
编译'org.springframework.security:spring-security-core:'+ spring_security_version
compile'org.springframework.security:spring-security-web:'+ spring_security_version
compile'org.springframework.security: spring-security-config:'+ spring_security_version
// JSTL
编译'jstl:jstl:1.2'
// slf4j-log4j
编译'org.slf4j:slf4j-api :1.7.0'
compile'org.slf4j:slf4j-log4j12:1.7.0'
编译'log4j:log4j:1.2.17'
// mybatis
编译' org.mybatis:MyBatis的: 3.2.4'
compile'org.mybatis:mybatis-spring:1.2.2'
// gson
compile'com.google.code.gson:gson:2.2.4'
//验证jsr303
编译'javax.validation:validation-api:1.0.0.GA'
// junit4(测试?)
编译'junit:junit:4.11'
// spring test(test?)
compile'org.springframework:spring-test:'+ spring_version
// java mail
compile'javax.mail:mail:1.4 '
// tomcat插件
def tomcatVersion ='7.0.53'
tomcatorg.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'
}
//附加类路径
classpath'org.gradle.api.plugins:gradle-tomcat-plugin:1.2.3'
classpat h'org.postgresql:postgresql:9.2-1004-jdbc4'
}
}
build.gradle
还有几个任务和几个 apply plugin
。
有什么问题?全堆栈跟踪
我的 build.gradle
位于项目文件夹中。
构建脚本正在混合 buildscript
依赖关系(即
- 构建本身的依赖关系;通常这意味着具有常规依赖关系的Gradle插件
- (即,要编译/运行的代码的依赖关系)。 $ b
2需要进入依赖关系{...}
,而不是进入 buildscript {dependencies {...}}
。
除了 classpath
依赖关系是常规的依赖关系。
I'm trying to execute some .sql
scripts and then deploy web app using gradle tomcat plugin
.
But when I make any attempt to run gradle
I've got an error
My buildscript
looks like this
buildscript {
//repository location
repositories {
mavenCentral()
jcenter()
}
//dependencies
//did not divide them into runtime&compile
dependencies {
//aspectJ dependencies
compile 'org.aspectj:aspectjlib:1.6.2'
compile 'org.aspectj:aspectjrt:1.7.4'
compile 'org.aspectj:aspectjweaver:1.7.4'
//servlet
compile 'javax.servlet:javax.servlet-api:3.0.1'
//jdbc postresql
compile 'org.postgresql:postgresql:9.2-1004-jdbc4'
//commons dbcp
compile 'commons-dbcp:commons-dbcp:1.2.2'
//spring & spring MVC dependencies
compile 'org.springframework:spring-core:' + spring_version
compile 'org.springframework:spring-web:' + spring_version
compile 'org.springframework:spring-webmvc:' + spring_version
compile 'org.springframework:spring-jdbc:' + spring_version
compile 'org.springframework:spring-aspects:' + spring_version
//spring security
compile 'org.springframework.security:spring-security-core:' + spring_security_version
compile 'org.springframework.security:spring-security-web:' + spring_security_version
compile 'org.springframework.security:spring-security-config:' + spring_security_version
//JSTL
compile 'jstl:jstl:1.2'
//slf4j-log4j
compile 'org.slf4j:slf4j-api:1.7.0'
compile 'org.slf4j:slf4j-log4j12:1.7.0'
compile 'log4j:log4j:1.2.17'
//mybatis
compile 'org.mybatis:mybatis:3.2.4'
compile 'org.mybatis:mybatis-spring:1.2.2'
//gson
compile 'com.google.code.gson:gson:2.2.4'
//validation jsr303
compile 'javax.validation:validation-api:1.0.0.GA'
//junit4(test?)
compile 'junit:junit:4.11'
//spring test(test?)
compile 'org.springframework:spring-test:' + spring_version
//java mail
compile 'javax.mail:mail:1.4'
//tomcat plugin
def tomcatVersion = '7.0.53'
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'
}
//additional classpath
classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:1.2.3'
classpath 'org.postgresql:postgresql:9.2-1004-jdbc4'
}
}
In build.gradle
there are also several tasks and several apply plugin
.
What's the problem? Full stack trace
My build.gradle
is in a project folder.
The build script is mixing up buildscript
dependencies (i.e.
- dependencies of the build itself; typically this means Gradle plugins
- with regular dependencies (i.e. dependencies of the code to be compiled/run).
2 needs to go into dependencies { ... }
, not into buildscript { dependencies { ... } }
.
Everything but the classpath
dependencies are regular dependencies.
这篇关于找不到参数的方法compile()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!