diff --git a/pom.xml b/pom.xml index e9455c5..ea65d55 100644 --- a/pom.xml +++ b/pom.xml @@ -44,8 +44,8 @@ org.codehaus.groovy - groovy - 1.6.5 + groovy-xml + 3.0.7 @@ -67,6 +67,14 @@ + + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + + diff --git a/src/main/java/com/cloudbees/maven/license/ProcessMojo.java b/src/main/java/com/cloudbees/maven/license/ProcessMojo.java index 846fac8..48d4e07 100644 --- a/src/main/java/com/cloudbees/maven/license/ProcessMojo.java +++ b/src/main/java/com/cloudbees/maven/license/ProcessMojo.java @@ -32,6 +32,7 @@ import java.io.File; import java.io.IOException; +import java.net.URISyntaxException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -146,11 +147,21 @@ public void execute() throws MojoExecutionException { } } - if (generateLicenseXml!=null) - comp.add((LicenseScript) shell.parse(getClass().getResourceAsStream("xmlgen.groovy"),"xmlgen.groovy")); + if (generateLicenseXml!=null) { + try { + comp.add((LicenseScript) shell.parse(getClass().getResource("xmlgen.groovy").toURI())); + } catch (URISyntaxException | IOException e) { + throw new MojoExecutionException("Failed to retrieve xmlgen.groovy", e); + } + } - if (generateLicenseHtml!=null) - comp.add((LicenseScript) shell.parse(getClass().getResourceAsStream("htmlgen.groovy"),"htmlgen.groovy")); + if (generateLicenseHtml!=null) { + try { + comp.add((LicenseScript) shell.parse(getClass().getResource("htmlgen.groovy").toURI())); + } catch (URISyntaxException | IOException e) { + throw new MojoExecutionException("Failed to retrieve htmlgen.groovy", e); + } + } if (inlineScript!=null) comp.add((LicenseScript)shell.parse(inlineScript,"inlineScript"));