Skip to content

Commit

Permalink
Fixed karaf4 failing on java11 (#756)
Browse files Browse the repository at this point in the history
  • Loading branch information
garethahealy authored Jun 16, 2019
1 parent b1a23e7 commit f730cec
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/dozer-osgi-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<properties>
<osgi.Export-Package>com.github.dozermapper.osgitests.*</osgi.Export-Package>

<karaf4-version>4.2.2</karaf4-version>
<karaf4-version>4.2.6</karaf4-version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public void canGetBundleFromDozerCore() {

//Ignore any Karaf bundles
if (current.getSymbolicName().startsWith("org.apache.karaf")
|| current.getSymbolicName().startsWith("org.jline")) {
|| current.getSymbolicName().startsWith("org.apache.aries.blueprint.core.compatibility")
|| current.getSymbolicName().startsWith("org.jline")) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,16 @@ protected Option karafContainerConfigOptions(String version) {
}

private Option getJavaModuleOptions() {
if (JavaVersionUtil.getMajorVersion() >= 9 && JavaVersionUtil.getMajorVersion() <= 10) {
if (JavaVersionUtil.getMajorVersion() >= 9) {
return composite(
vmOption("--add-reads=java.xml=java.logging"),
vmOption("--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),

vmOption("--patch-module"),
vmOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-" + System.getProperty("karaf.version") + ".jar"),
vmOption("--patch-module"),
vmOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-" + System.getProperty("karaf.version") + ".jar"),

vmOption("--add-opens"),
vmOption("java.base/java.security=ALL-UNNAMED"),
vmOption("--add-opens"),
Expand All @@ -134,13 +142,10 @@ private Option getJavaModuleOptions() {

vmOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
vmOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
vmOption("--add-exports=java.xml.bind/com.sun.xml.internal.bind.v2.runtime=ALL-UNNAMED"),
vmOption("--add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED"),
vmOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
vmOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
vmOption("--add-exports=java.xml.ws/com.sun.xml.internal.messaging.saaj.soap.impl=ALL-UNNAMED"),

vmOption("--add-modules"),
vmOption("java.xml.ws.annotation,java.corba,java.transaction,java.xml.bind,java.xml.ws,jdk.xml.bind")
vmOption("-classpath"),
vmOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*")
);
} else {
return composite();
Expand Down

0 comments on commit f730cec

Please sign in to comment.