2017-01-12 3 views
8

मैं इस कोड है:डेप्रिकेशन चेतावनी

task fatJar(type: Jar) << { 
    manifest { 
     attributes 'Implementation-Title': 'Gradle Jar File Example', 
       'Implementation-Version': version, 
       'Main-Class': 'mvc.MvcMain' 
    } 
    baseName = project.name + '-all' 
    with jar 
} 

मैं इस चेतावनी मिल गया:

कार्य के निष्पादन के समय प्रतिलिपि कार्य के बच्चे चश्मा का विन्यास पदावनत किया गया है और निकालने के लिए शेड्यूल है Gradle 4.0 में। कॉन्फ़िगरेशन समय के दौरान spec को कॉन्फ़िगर करने पर विचार करें, या कॉन्फ़िगरेशन करने के लिए अलग-अलग कार्य का उपयोग करें।

Task.leftShift (क्लोजर) विधि पदावनत किया गया है और Gradle 5.0 में निकालने के लिए शेड्यूल किया गया है: build_b2xrs1xny0xxt8527sk0dvm2y $ _run_closure4.doCall

और इस चेतावनी पर । कृपया इसके बजाय कार्य .doLast (एक्शन) का उपयोग करें।

मेरे कार्य को फिर से लिखने के लिए कैसे?

+0

http://mrhaki.blogspot.com/2016/11/gradle-goodness- पर क्यों की एक छोटी लेख नहीं है replacing-operator-for.html – Thad

उत्तर

16

< < हटाने और doLast साथ लपेट {...}

// Since Gradle 3.2 the << (leftShift) operator 
// is deprecated. The operator can confuse 
// people, because without the operator 
// we would configure the deprecatedSample task, 
// instead of adding the action statement: 
// println 'Sample task'. 
task deprecatedSample << { 
    println 'Sample task' 
} 

// To have no confusion we should use 
// the doLast method of a task to add 
// the action statement: 
// println 'Sample task'. 
task newSample { 
    doLast { 
     println 'Sample task' 
    } 
} 
+1

क्या आप http://mrhaki.blogspot.se/2016/11/gradle-goodness-replacing-operator-for.html के लेखक हैं? अन्यथा आप लेखक क्रेडिट देना चाहते हैं। – jayeffkay

संबंधित मुद्दे