簡體   English   中英

使用 Eclipse Buildship 插件運行 gradle 構建任務時如何排除測試任務?

[英]How to exclude test task when the gradle build task is run using Eclipse Buildship plugin?

我正在使用 Eclipse Buildship 插件在我的項目上執行 Gradle 任務。 知道如何在運行構建任務時排除測試任務嗎? Gradle STS插件中,我曾經將程序參數更新為“ -x test ”,從而跳過了測試任務。 當我對 Buildship 進行同樣的嘗試時,出現以下錯誤。

* What went wrong:
Task ' test' not found in root project

您是否考慮過運行“組裝”任務而不是“構建”?

:build
+--- :assemble
|    \--- :jar
|         \--- :classes
|              +--- :compileJava
|              \--- :processResources
\--- :check
     \--- :test
          +--- :classes
          |    +--- :compileJava
          |    \--- :processResources
          \--- :testClasses
               +--- :compileTestJava
               |    \--- :classes
               |         +--- :compileJava
               |         \--- :processResources
               \--- :processTestResources

將“-x test”添加到運行配置中的程序參數

為了我。 我必須將“-x”和“測試”放在不同的行上,以便 BuildShip 工作。

在構建文件中添加代碼以排除不運行的測試類。
如果您排除所有測試類,那么它實際上是“跳過”測試步驟。 好吧,實際上測試步驟“運行”但沒有測試將運行。
這在開發時也很方便,但有些測試僅用於開發工作,稍后會整理。 它還為其他開發人員提供了一個很好的提示(或提醒)在哪里可以找到操作開發測試。

// include this in your build.gradle file,
// and update the package selector lines    
    test { 
        // The excluded classes won't be called by the test step.
        // They're for manual calls during devwrk only.
            exclude 'devonly/sometests/**'
            exclude '**/Bar.class'
        }

嘗試在運行配置的程序參數部分的兩行中添加 -x 和:test

暫無
暫無

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

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