2017-10-02 16 views
0

私のJenkinsパイプラインではMaven Surefireプラグインをビルドしようとしていますので、パイプライン内でMaven Testを実行し、テストの失敗を無視してパイプライン処理を続行できます。Mavenクリーンデプロイ時のエラー

私はコマンドを使用しようとした場合しかし、私はエラーを取得、次の

mvn clean deploy -Dmaven.test.failure.ignore=false 
:それは動作しませんなぜ

class org.codehaus.groovy.ast.expr.UnaryMinusExpression, with its value 'Dmaven.test.failure.ignore', is a bad expression as the left hand side of an assignment operator at line: 6 column: 51. File: WorkflowScript @ line 6, column 51. 
    oy -Dmaven.test.failure.ignore=false 
           ^

私はかなり誰もが説明できる、理解していませんか?

答えて

1

Mavenのコマンドラインコールは、groovyコマンドとして解釈されます。つまり、groovyスクリプトで構文エラーが発生しました。

0

ヨは、パイプラインのMavenプラグインを使用して、シェル段階でMavenの呼び出しを実行する必要があります。

https://wiki.jenkins.io/display/JENKINS/Pipeline+Maven+Plugin

例:

withMaven(
     // Maven installation declared in the Jenkins "Global Tool Configuration" 
     maven: 'M3', 
     // Maven settings.xml file defined with the Jenkins Config File Provider Plugin 
     // Maven settings and global settings can also be defined in Jenkins Global Tools Configuration 
     mavenSettingsConfig: 'my-maven-settings', 
     mavenLocalRepo: '.repository') { 

     // Run the maven build 
     sh "mvn clean deploy -Dmaven.test.failure.ignore=false" 

    } // withMaven will discover the generated Maven artifacts, JUnit Surefire & FailSafe reports and FindBugs reports 
関連する問題