Gradle:War项目不包括由子项目构建的JAR

时间:2013-12-18 00:26:21

标签: java jar gradle war

我有一个构建WAR的根项目,以及一个构建JAR的子项目。 根项目以这种方式引用子项目:

dependencies{
   runtime project(':childProject')
}

问题:生成的WAR文件不包含子项目构建的JAR文件。

更新:根项目的脚本:

apply plugin: 'war'

jar.enabled = false
war {
    dependencies {
        runtime project(':childProject')
    }

    // For each JAR: copy content of META-INF/resources/* to the root folder of WAR
    into("/") {
        from { collectMetainfResources(classpath)
        }
    }
}


// Collects META-INF/resources folders from JARs on classpach
def collectMetainfResources(classpath) {
    FileCollection collectedResources = files{}

    // For each JAR on classpath
    for(file in classpath) {
    }

    return collectedResources
}

似乎collectMetainfResources(classpath)函数修改了classpath。 如果我删除for(file in classpath)循环,则类路径是正确的并包含JAR。 为什么这个循环修改了classpath变量?

0 个答案:

没有答案
相关问题