簡體   English   中英

gradle:為什么沒有針對所有sourceSet的jar任務

[英]gradle: why there is no jar task for all sourceSets

添加了sourceSet Web,但是沒有相應的任務:

apply plugin: 'java'
sourceSets {
    web
}

Build tasks
-----------
assemble - Assembles the outputs of this project.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles main classes.
clean - Deletes the build directory.
jar - Assembles a jar archive containing the main classes.
testClasses - Assembles test classes.
webClasses - Assembles web classes.

我期待以下任務

webJar

Gradle組裝和構建:不構建Web sourceSet。

每個sourceSet都不存在jar任務,因為在大多數項目中不需要該jar。 例如,java項目帶有兩個sourceSets(main和test)。 不需要用於測試sourceSet的jar,因為沒有它就可以運行測試。

如果您需要一個jar作為其他sourceSet,則可以輕松創建一個:

task myJar(type:Jar){
    from sourceSets.mySourceSet.output  
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM