2016-08-02 18 views
0

Das ist meine build.gradle DateiErzwingen die Reihenfolge des Einsatzes in 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' 
     } 
    } 
} 

Das Problem, das ist passiert, dass die deployToTomcat erstes laufen und auf dem Kater einen alten Krieg einzusetzen. Danach läuft die Kriegsaufgabe des Kriegs-Plugins und erzeugt einen neuen Krieg, der niemals zum Einsatz kommt. Kann mir jemand bei der Durchsetzung der Reihenfolge dieser Aktionen helfen?

Antwort

0

Sie müssen "dependsOn war" in Ihrer deployToTomcat Aufgabe hinzufügen.

+0

täte, funktioniert nicht –

+0

den Block über deployToTomcat.doFirst entfernen { Krieg() } – Joshua

+0

Ich habe diesen Code auf diese Weise modifiziert, 'Aufgabe deployToTomcat (DependsOn: Krieg) { \t Kopie { \t \t von "build/lib" \t \t in "$ {System.properties [ 'TOMCAT_HOME']}/webapps" \t \t umfassen "* .war" \t} } ' –