2017-01-12 20 views
8

mam ten kod:amortyzacyjne ostrzeżenia

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 
} 

mam to ostrzeżenie:

Konfigurowanie specyfikacje podrzędne zadania kopiowania w czasie wykonywania zadania jest przestarzała i ma zostać usunięty w Gradle 4.0. Rozważ konfigurację specyfikacji w czasie konfiguracji lub oddzielne zadanie , aby przeprowadzić konfigurację. na build_b2xrs1xny0xxt8527sk0dvm2y $ _run_closure4.doCall

i tego ostrzeżenia:

Sposób Task.leftShift (zamknięcie) jest przestarzała i ma zostać usunięta w Gradle 5.0. Zamiast tego użyj Task.doLast (Action) .

Jak przepisać moje zadanie?

+0

Jest to krótki write-up, dlaczego w http://mrhaki.blogspot.com/2016/11/gradle-goodness- replaceing-operator-for.html – Thad

Odpowiedz

16

usunąć < < i owinąć go 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

Czy jesteś autorem http://mrhaki.blogspot.se/2016/11/gradle-goodness-replacing-operator-for.html? W przeciwnym razie możesz przyznać autorowi kredyt. – jayeffkay