The following line of code:
SoyFileSet sfs = sfsBuilder.add(this.getClass().getResource("templates/mail.soy")).build();
works when run outside of a Jar but fails with a null pointer exception. Similar posts indicate that I should try getResourceAsStream but the add method wants a URL. So I think I have to convert the Stream to a URL but it is not clear to me exactly how to proceed.