title: Jenkins pipeline: join file / URL paths
body: <p>How can I join strings nicely into a path when programming Jenkins Groovy pipeline? So that I can <code>join('http://example.com/', '/r', 'some.html') -&gt; 'http://example.com/r/some.html'</code></p>
  
  <p><a href="https://serviceorientedarchitect.com/how-to-combinejoin-file-paths-in-gradlegroovy/" rel="nofollow noreferrer">This note</a> suggests using <code>new File(dir1, dir2)</code> or <code>Paths.get(dir1, dir2)</code> in "pure" Groovy.</p>
  
  <p>However in Jenkins pipeline, <code>import java.nio.file.Paths</code> gives me</p>
  
  <pre><code>No such static method found: staticMethod java.nio.file.Paths get java.lang.String org.codehaus.groovy.runtime.GStringImpl.
  </code></pre>
  
  <p>and with <code>new File</code> I get</p>
  
  <pre><code>Scripts not permitted to use new java.io.File java.lang.String java.lang.String. Administrators can decide whether to approve or reject this signature.
  </code></pre>
  
  <p>and I kinda agree with Jenkins on this do not want to allow this. Is there another way?</p>