我試圖使用gradle這個編譯war文件部署到一個JBoss AS 7.1,但它無法編譯(找不到ServletContext中)....gradle這個戰爭並不想編譯我的項目
見下面爲gradle.build。
錯誤:
/workspace/AgileRunner/src/main/java/com/agilerunner/web/config/AgileRunnerApplicationInitializer.java:20:找不到符號 符號:方法的addListener(org.springframework .web.context.ContextLoaderListener) location:interface javax.servlet.ServletContext servletContext.addListener(new ContextLoaderListener(rootContext)); ^ /workspace/AgileRunner/src/main/java/com/agilerunner/web/config/AgileRunnerApplicationInitializer.java:22:找不到符號 symbol:method addServlet(java.lang.String,org.springframework.web.servlet .DispatcherServlet) location:interface javax.servlet.ServletContext ServletRegistration.Dynamic dispatcher = servletContext.addServlet(「dispatcher」,new DispatcherServlet(rootContext)); ^ 2錯誤 :compileJava失敗
gradle.build:
apply plugin:'eclipse'
apply plugin:'war'
apply plugin:'cargo'
repositories {
mavenCentral()
}
dependencies {
def cargoVersion = '1+'
cargo 'org.codehaus.cargo:cargo-core-uberjar:$cargoVersion',
'org.codehaus.cargo:cargo-ant:$cargoVersion',
'org.jboss.as:jboss-as-controller-client:7.1+'
providedCompile 'javax.servlet:servlet-api:2+',
'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1+',
'org.jboss.as:jboss-as-controller-client:7.1+'
compile 'org.springframework:spring-context:4+',
'org.springframework:spring-webmvc:4+',
'org.thymeleaf:thymeleaf:2+',
'org.thymeleaf:thymeleaf-spring4:2+',
'log4j:log4j:1+'
testCompile 'junit:junit:4+'
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-cargo-plugin:0+'
}
}
cargo {
containerId = 'jboss71x'
port = 8080
remote {
hostname = '127.0.0.1'
}
}
感謝您的幫助。
Y.