2016-08-02 5 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が最初に実行されているとTomcat上の古い戦争を展開しているということです。その後、戦争のプラグインの戦争のタスクが実行され、展開されることは決してない新しい戦争を生成します。誰かがこれらの行動の命令を強制するのを助けることができますか?

答えて

0

deployToTomcatタスクに「dependsOn war」を追加する必要があります。

+0

{) 戦争( } deployToTomcat.doFirstについてのブロックを削除 –

+0

を働いていない、という私は、このように 'タスクdeployToTomcat(DEPENDSON:戦争)そのコードを変更した – Joshua

+0

んでした{ \tコピー{ \t \tを \t \tに "LIB /構築" から "$ {System.properties [ 'TOMCAT_HOME']}/webappsには、" \t \tは "* .warの" が含ま\t} } ' –

関連する問題