diff --git a/src/main/java/org/jenkinsci/maven/plugins/hpi/TestInsertionMojo.java b/src/main/java/org/jenkinsci/maven/plugins/hpi/TestInsertionMojo.java index 1466d4b39..f50edc4e0 100644 --- a/src/main/java/org/jenkinsci/maven/plugins/hpi/TestInsertionMojo.java +++ b/src/main/java/org/jenkinsci/maven/plugins/hpi/TestInsertionMojo.java @@ -64,6 +64,12 @@ public class TestInsertionMojo extends AbstractJenkinsMojo { @Parameter(property = "jelly.requirePI", defaultValue = "true") private boolean requirePI; + /** + * If true, verify that all the jelly scripts don't contain inline javascript. + */ + @Parameter(property = "jelly.prohibitInlineJS", defaultValue = "true") + private boolean prohibitInlineJS; + /** * Optional string that represents "groupId:artifactId" of the Jenkins test harness. * If left unspecified, the default groupId/artifactId pair for the Jenkins test harness is looked for. @@ -138,7 +144,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { class %s extends org.jvnet.hudson.test.injected.InjectedTestBase { %s() { - super("%s", "%s", "%s", "%s", %b); + super("%s", "%s", "%s", "%s", %b, %b); } } """.formatted( @@ -149,12 +155,12 @@ class %s extends org.jvnet.hudson.test.injected.InjectedTestBase { project.getArtifactId(), project.getVersion(), escape(project.getBuild().getOutputDirectory()), - requirePI); + requirePI, + prohibitInlineJS); Files.writeString(javaFile.toPath(), content); } catch (IOException e) { throw new MojoExecutionException("Failed to create injected tests", e); } - project.addTestCompileSourceRoot(f.getAbsolutePath()); try {