这是我的build.gradle文件
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.moowork.gradle:gradle-grunt-plugin:0.13'
classpath "gradle.plugin.com.github.scobal.eslint:gradle-eslint-plugin:1.0.1"
}
}
plugins{
id "com.moowork.grunt" version "0.13"
id "com.moowork.node" version "0.13"
}
// apply all plug-ins
apply plugin: 'com.moowork.grunt'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'war'
apply plugin: "com.github.scobal.eslint"
sourceCompatibility = 1.8
//version = '24.1.1.0'
war.doFirst{
deleteFiles()
grunt_build()
grunt_compile()
}
task deleteFiles(type: Delete){
delete fileTree("${System.properties['TOMCAT_HOME']}/webapps"){
include '**/*.war'
}
}
task deployToTomcat(type: Copy) {
from war.archivePath
into "${System.properties['TOMCAT_HOME']}/webapps"
}
deployToTomcat.doFirst{
war()
}
clean.doFirst{
deleteFiles
}
eslint {
inputs = ["./src/**/*.js"]
}
// exclude the files we don't want to deliver
// TODO - is there an easier way to exclude all directories under js??? We don't want any of them.
war {
exclude('src/js/main.js')
exclude('src/js/actions')
exclude('src/js/api')
exclude('src/js/components')
exclude('src/js/constants')
exclude('src/js/dispatcher')
exclude('src/js/stores')
}
jar {
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart' //,
//'Implementation-Version': version
}
}
repositories {
mavenCentral()
}
dependencies {
compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
compile("org.springframework:spring-webmvc:4.0.3.RELEASE")
compile("com.fasterxml.jackson.core:jackson-core:2.7.4")
compile("com.fasterxml.jackson.core:jackson-annotations:2.7.4")
compile("com.fasterxml.jackson.core:jackson-databind:2.7.4")
compile("org.darkphoenixs:log4j:1.2.17")
compile files('libs/opla230.jar')
testCompile group: 'junit', name: 'junit', version: '4.+'
}
test {
systemProperties 'property': 'value'
}
uploadArchives {
repositories {
flatDir {
dirs 'repos'
}
}
}
正在发生的问题是deployToTomcat首先运行并在tomcat上部署旧战争。在那之后,战争插件的战争任务运行并产生一个永远不会被部署的新战争。有人可以帮助我执行这些操作的顺序。
答案 0 :(得分:0)
您需要在deployToTomcat任务中添加“dependsOn war”。