I am trying to create a Jenkins Pipeline Script using groovy. However, the import
statement is giving me a compilation error - Unknown Type : Import. Not sure why.
You should define import jxl.*
at the top of the pipeline script, e.g.
import jxl.*
node {
stage('Execute Tests') {
try {
dir('.') {
sh '......' // etc.
}
}
}
}
When you added it inside node {}
block Jenkins was looking for a method instead of import class statement. The good convention is to put all import statements at the top of the Groovy file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With