();
+
+ for(int i = 0; i < nodes.getLength(); i++) {
+ features.add(nodes.item(i).getTextContent().trim());
+ }
+
+ Assert.assertTrue("ejbLite-3.2 found ==>", features.contains("ejbLite-3.2"));
+ Assert.assertTrue("mongodb-2.0 found ==>", features.contains("mongodb-2.0"));
+ Assert.assertTrue("jsp-2.3 found ==>", features.contains("jsp-2.3"));
+
+ // parse input XML Document
+ String expression2 = "/server/jspEngine";
+ nodes = (NodeList) xPath.compile(expression2).evaluate(inputDoc, XPathConstants.NODESET);
+ Assert.assertEquals("Number of elements ==>", 1, nodes.getLength());
+
+ if (nodes.item(0) instanceof Element) {
+ Element child = (Element) nodes.item(0);
+ String nodeValue = child.getAttribute("javaSourceLevel");
+ Assert.assertTrue("Unexpected javaSourceLevel ==>"+nodeValue, nodeValue.equals("17"));
+ }
+ }
+ }
+}
diff --git a/liberty-maven-plugin/src/it/compile-jsp-source-17-it/src/test/resources/server.xml b/liberty-maven-plugin/src/it/compile-jsp-source-17-it/src/test/resources/server.xml
new file mode 100644
index 000000000..f3b493111
--- /dev/null
+++ b/liberty-maven-plugin/src/it/compile-jsp-source-17-it/src/test/resources/server.xml
@@ -0,0 +1,5 @@
+
+
+ jsp-2.3
+
+
diff --git a/liberty-maven-plugin/src/it/compile-jsp-source-17-it/webapp/index.jsp b/liberty-maven-plugin/src/it/compile-jsp-source-17-it/webapp/index.jsp
new file mode 100644
index 000000000..1153e9e08
--- /dev/null
+++ b/liberty-maven-plugin/src/it/compile-jsp-source-17-it/webapp/index.jsp
@@ -0,0 +1,10 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
+ Maven test install artifact
+
+
+ Successful installation of war
+ Maven test war has been successfully installed into the server.
+
+
diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/jsp/CompileJspMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/jsp/CompileJspMojo.java
index 92c523d77..1db2b1237 100644
--- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/jsp/CompileJspMojo.java
+++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/jsp/CompileJspMojo.java
@@ -18,6 +18,7 @@
import java.io.File;
import java.text.MessageFormat;
import java.util.List;
+import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
@@ -83,15 +84,28 @@ private void doCompileJsps() throws MojoExecutionException {
// don't delete temporary server dir
compile.setCleanup(false);
+ boolean sourceSet = false;
+
List plugins = getProject().getBuildPlugins();
for (Plugin plugin : plugins) {
if ("org.apache.maven.plugins:maven-compiler-plugin".equals(plugin.getKey())) {
Object config = plugin.getConfiguration();
if (config instanceof Xpp3Dom) {
Xpp3Dom dom = (Xpp3Dom) config;
- Xpp3Dom val = dom.getChild("source");
- if (val != null) {
- compile.setSource(val.getValue());
+ Xpp3Dom child = dom.getChild("release");
+ if (child != null && child.getValue() != null) {
+ String value = child.getValue();
+ getLog().debug("compile-jsp using maven.compiler.release value: "+value+" for javaSourceLevel.");
+ compile.setSource(value);
+ sourceSet = true;
+ } else {
+ child = dom.getChild("source");
+ if (child != null && child.getValue() != null) {
+ String value = child.getValue();
+ getLog().debug("compile-jsp using maven.compiler.source value: "+value+" for javaSourceLevel.");
+ compile.setSource(value);
+ sourceSet = true;
+ }
}
}
break;
@@ -107,6 +121,26 @@ private void doCompileJsps() throws MojoExecutionException {
}
}
+ if (!sourceSet) {
+ // look for Maven properties
+ Properties props = getProject().getProperties();
+ if (props.containsKey("maven.compiler.release")) {
+ String value = props.getProperty("maven.compiler.release");
+ if (value != null) {
+ getLog().debug("compile-jsp using maven.compiler.release value: "+value+" for javaSourceLevel.");
+ compile.setSource(value);
+ sourceSet = true;
+ }
+ } else if (props.containsKey("maven.compiler.source")) {
+ String value = props.getProperty("maven.compiler.source");
+ if (value != null) {
+ getLog().debug("compile-jsp using maven.compiler.source value: "+value+" for javaSourceLevel.");
+ compile.setSource(value);
+ sourceSet = true;
+ }
+ }
+ }
+
Set classpath = new TreeSet();
// first add target/classes (or whatever is configured)