2016-08-02 2 views
0

Это мой build.gradle файлНавязывание порядок развертывания в 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 запущен первый и развертывании старой войны кота. После этого начинается военная задача плагина войны и создается новая война, которая никогда не развертывается. Может ли кто-нибудь помочь мне с соблюдением порядка этих действий.

ответ

0

Вам нужно добавить «dependOn war» в свою задачу deployToTomcat.

+0

ли что, не работает –

+0

удалить блок о deployToTomcat.doFirst { войну() } – Joshua

+0

Я изменил этот код таким образом, 'задача deployToTomcat (dependsOn: война) { \t копию { \t \t от "строить/Библиотека" \t \t в "$ {System.properties [ 'TOMCAT_HOME']}/WebApps" \t \t включают "* .war" \t} } ' –

Смежные вопросы