Gradle任务执行顺序不为';我似乎没有遵守秩序

Gradle任务执行顺序不为';我似乎没有遵守秩序,gradle,Gradle,我编写了一个工具OwnerFinder,它对应用程序的一些jar进行一些注释处理。我需要在TeamCity上公开这个工具,所以我编写了一个gradle脚本,它执行以下任务 解压缩应用程序zip文件 将应用程序jar复制到位置build/appJars 编译工具OwnerFinder(将appjar保留在类路径中) 创建所有者的jar 运行OwnerFinder(将Appjar保留在类路径中) (我需要将app jar保留在类路径中,因为需要处理的注释位于这些jar中) 但不知何故,即使使用dep

我编写了一个工具OwnerFinder,它对应用程序的一些jar进行一些注释处理。我需要在TeamCity上公开这个工具,所以我编写了一个gradle脚本,它执行以下任务

  • 解压缩应用程序zip文件
  • 将应用程序jar复制到位置build/appJars
  • 编译工具OwnerFinder(将appjar保留在类路径中)
  • 创建所有者的jar
  • 运行OwnerFinder(将Appjar保留在类路径中)
  • (我需要将app jar保留在类路径中,因为需要处理的注释位于这些jar中)

    但不知何故,即使使用dependsOn和mustRunAfter,任务的顺序也无法保证。脚本在以下两个位置失败:

  • 编译任务(在依赖项中找不到注释) 或
  • 在无法找到类OwnerFinder的位置运行任务
  • 但在第二次或第三次尝试后,它运行成功。这让我觉得gradle任务没有按照顺序执行

    以下是我的gradle脚本:-

    apply from: 'http://some-gradle-util-script'
    apply plugin: 'java'
    
    
    def confs = ["someApplicationConf"]
    confs.each { configurations.create it }
    configurations { sources }
    
    configureDownload('ivy', 'ivy-integrated')
    
    dependencies {
        def someApplicationVersion = '1.12.0.+'
        someApplicationConf "com.soft:someApplication-sync:${someApplicationVersion}@zip"
        compile 'com.google.guava:guava:16.0.1',
                'com.google.code.gson:gson:2.2.2'
        testCompile group: 'junit', name: 'junit', version: '4.11'
    }
    
    task unzip(type: Copy, dependsOn: clean) {
            from zipTree(configurations.someApplicationConf.singleFile)
            into "$buildDir/unzipped"
    }
    
    task copyJar(type: Copy, dependsOn: unzip) {
        from "$buildDir/unzipped/modules"
        into "$buildDir/op"
    }
    
    copyJar.mustRunAfter unzip
    
    task compileOwnerFinder(type: JavaCompile, dependsOn: copyJar) {
        FileCollection f = files(fileTree(dir: 'build/op', include: '*.jar').files, configurations.compile.files)
        source = fileTree(dir: 'src', include: '**/*.java')
        classpath = f
        destinationDir = new File("$buildDir/classes/main")
    }
    
    compileOwnerFinder.mustRunAfter copyJar
    
    task jarOwnerFinder(type: Jar, dependsOn: compileOwnerFinder) {
        from files(sourceSets.main.output.classesDir)
    }
    
    task runOwnerFinder(type: Exec, dependsOn: jarR) {
        def classpath = fileTree(dir: 'build/op', include: '*.jar').files + configurations.compile.files +
                fileTree(dir: 'build/libs', include: '*.jar').files
        commandLine "java", "-classpath", classpath.join(File.pathSeparator), "OwnerFinder"
    }
    runOwnerFinder.mustRunAfter jarOwnerFinder
    

    gradle-m compileOwnerFinder
    的输出是什么样子的?
    E:\OwnerFinder>gradle-m compileOwnerFinder下载/1.12.0.594/ivy-1.12.0.594.xml下载/1.12.0.594/zip/someApplication-sync-1.12.0.594.zip:跳过清除:跳过解压缩:跳过copyJar:compileOwnerFinder跳过构建成功
    不知道为什么跳过这些任务“-m”始终跳过任务,并仅说明任务的调用顺序。我只是想知道任务相关性是否正确显示