2016-05-17 3 views

答えて

0

timeoutブロックを使用してタイムアウトエラーを作成します。

// We're wrapping this in a timeout - if it takes more than 180 minutes, kill it. 
timeout(time: 180, unit: 'MINUTES') { 
    // See below for what this method does - we're passing an arbitrary environment 
    // variable to it so that JAVA_OPTS and MAVEN_OPTS are set correctly. 
    withMavenEnv(["JAVA_OPTS=-Xmx1536m -Xms512m -XX:MaxPermSize=1024m", 
        "MAVEN_OPTS=-Xmx1536m -Xms512m -XX:MaxPermSize=1024m"]) { 
     // Actually run Maven! 
     // The -Dmaven.repo.local=${pwd()}/.repository means that Maven will create a 
     // .repository directory at the root of the build (which it gets from the 
     // pwd() Workflow call) and use that for the local Maven repository. 
     sh "mvn -Pdebug -U clean install ${runTests ? '-Dmaven.test.failure.ignore=true -Dconcurrency=1' : '-DskipTests'} -V -B -Dmaven.repo.local=${pwd()}/.repository" 
    } 
} 
+0

これはユニットテストに特化したものではありません。これは、Jenkins CI Jenkinsfileの例です。 – granadaCoder

+0

'timeout(){}'に入ることができます。 Mavenライフサイクル全体にタイムアウトを設定する代わりに、単体テストを実行するためにMSTestプラグインを使用することができます。 OPがすべてのテストを実行するのにかかる時間ではなく、個々のテストでタイムアウトしたい場合は、MSTestに固有のものです。 – walsht

関連する問題