user1050619
user1050619

Reputation: 20866

No such DSL method 'publishHTML' found among steps

I have a jenkins DSL step that runs my python nosetests and creates a unittest coverage report.

Here is my jenkins stage.

stage ('Unit Tests') {
            steps {
                sh """
                    #. venv/bin/activate
                    export PATH=${VIRTUAL_ENV}/bin:${PATH}
                    make unittest || true
                """
            }

            post {
                always {
                    junit keepLongStdio: true, testResults: 'report/nosetests.xml'
                    publishHTML target: [
                        reportDir: 'report/coverage',
                        reportFiles: 'index.html',
                        reportName: 'Coverage Report - Unit Test'
                    ]
                }
            }
        }

I get this error -

java.lang.NoSuchMethodError: No such DSL method 'publishHTML' found among steps.

How can I fix this error? I got this piece of code from a different repository.

Upvotes: 4

Views: 4637

Answers (1)

Matthew Schuchard
Matthew Schuchard

Reputation: 28774

The publishHTML method is provided by the HTLMPublisher Jenkins plugin. After installing the plugin on the primary Jenkins server, the publishHTML method will be available in the Jenkins Pipeline for both scripted and declarative syntax.

Upvotes: 11

Related Questions