Commands fail when moving to them custom class in jenkinsfile
<p>I'm setting up a new build. Running a simple shell command works perfectly, like below:</p>

<pre><code>stage("Demo") {    
    sh "echo 'Hi There'"
}
</code></pre>

<p>I have been trying to "package" my shell scripts into their own classes just to neaten things up a bit. The problem is that when trying to execute the same exact shell script from within a class, jenkins fails the builds with:</p>

<blockquote>
  <p>org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException:
  unclassified method java.lang.Class sh java.lang.String</p>
</blockquote>

<p>This is a simple example that fails for me after moving the above method into its own class:</p>

<pre><code>stage('Demo stage') {
    Tools.PrintMe("Hi There")   
}

public class Tools {
    public static void PrintMe(String message) {
        sh "echo " + message
    }
}
</code></pre>

<p>There is also no option provided in the script manager to Whitelist this rejected method. </p>

<p>Is there a way to get around this? Or is there a limitation that I'm not aware of?</p>