Repository: iluwatar/java-design-patterns
Issue: Java 11 support: Upgrade dependencies
Labels: info: help wanted
resolution: won't fix
epic: dependencies

This task is part of the Java 11 transition plan https://github.com/iluwatar/java-design-patterns/wiki/16.-Java-11-Transition

Upgrade project dependencies so that they support Java 11. Most of the dependencies can be found in main `pom.xml` dependencyManagement section.

Links:
https://www.infoq.com/articles/upgrading-java-8-to-12/ and https://winterbe.com/posts/2018/08/29/migrate-maven-projects-to-java-11-jigsaw/

Issue comments:
Also see if https://github.com/iluwatar/java-design-patterns/issues/838 can be closed after the dependency update
This issue can be closed as we are already JDK11 compliant

Pull request review comments:

Patch that resolved the issue:
diff --git a/.travis.yml b/.travis.yml
index 84b031fadcc1..45323dcfd457 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,6 @@
 language: java
 dist: xenial
 jdk:
-- openjdk8
 - openjdk11
 
 env:
diff --git a/cqrs/pom.xml b/cqrs/pom.xml
index fc89a93b7c79..9c9458505aba 100644
--- a/cqrs/pom.xml
+++ b/cqrs/pom.xml
@@ -38,26 +38,18 @@
 			<groupId>org.hibernate</groupId>
 			<artifactId>hibernate-core</artifactId>
 		</dependency>
+		<dependency>
+			<groupId>com.sun.xml.bind</groupId>
+			<artifactId>jaxb-impl</artifactId>
+			<scope>test</scope>
+			<version>2.1.17</version>
+		</dependency>
+		<dependency>
+			<groupId>javax.xml.bind</groupId>
+			<artifactId>jaxb-api</artifactId>
+			<scope>test</scope>
+		</dependency>
+
 	</dependencies>
-	<profiles>
-		<profile>
-			<id>jdk11-deps</id>
-			<activation>
-				<jdk>[11,)</jdk>
-			</activation>
-			<dependencies>
-				<dependency>
-					<groupId>com.sun.xml.bind</groupId>
-					<artifactId>jaxb-impl</artifactId>
-					<scope>test</scope>
-					<version>2.1.17</version>
-				</dependency>
-				<dependency>
-					<groupId>javax.xml.bind</groupId>
-					<artifactId>jaxb-api</artifactId>
-					<scope>test</scope>
-				</dependency>
-			</dependencies>
-		</profile>
-	</profiles>
+
 </project>
diff --git a/eip-aggregator/pom.xml b/eip-aggregator/pom.xml
index 39270f02097e..6a5e32845cfc 100644
--- a/eip-aggregator/pom.xml
+++ b/eip-aggregator/pom.xml
@@ -47,6 +47,15 @@
             <version>${camel.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+        </dependency>
+
         <!-- Testing -->
         <dependency>
             <groupId>com.github.sbrannen</groupId>
@@ -71,23 +80,4 @@
 
     </dependencies>
 
-    <profiles>
-        <profile>
-            <id>jdk11-deps</id>
-            <activation>
-                <jdk>[11,)</jdk>
-            </activation>
-            <dependencies>
-                <dependency>
-                    <groupId>com.sun.xml.bind</groupId>
-                    <artifactId>jaxb-impl</artifactId>
-                </dependency>
-                <dependency>
-                    <groupId>javax.xml.bind</groupId>
-                    <artifactId>jaxb-api</artifactId>
-                </dependency>
-            </dependencies>
-        </profile>
-    </profiles>
-
 </project>
diff --git a/eip-splitter/pom.xml b/eip-splitter/pom.xml
index 7319f651939c..9769d08034a7 100644
--- a/eip-splitter/pom.xml
+++ b/eip-splitter/pom.xml
@@ -47,6 +47,16 @@
             <version>${camel.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+        </dependency>
+
+
         <!-- Testing -->
         <dependency>
             <groupId>com.github.sbrannen</groupId>
@@ -71,24 +81,4 @@
 
     </dependencies>
 
-    <profiles>
-        <profile>
-            <id>jdk11-deps</id>
-            <activation>
-                <jdk>[11,)</jdk>
-            </activation>
-            <dependencies>
-                <dependency>
-                    <groupId>com.sun.xml.bind</groupId>
-                    <artifactId>jaxb-impl</artifactId>
-                </dependency>
-                <dependency>
-                    <groupId>javax.xml.bind</groupId>
-                    <artifactId>jaxb-api</artifactId>
-                </dependency>
-            </dependencies>
-        </profile>
-    </profiles>
-
-
 </project>
diff --git a/eip-wire-tap/pom.xml b/eip-wire-tap/pom.xml
index a9d30924204a..c96063418c46 100644
--- a/eip-wire-tap/pom.xml
+++ b/eip-wire-tap/pom.xml
@@ -47,6 +47,16 @@
             <version>${camel.version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+        </dependency>
+
+
         <!-- Testing -->
         <dependency>
             <groupId>com.github.sbrannen</groupId>
@@ -71,22 +81,4 @@
 
     </dependencies>
 
-    <profiles>
-        <profile>
-            <id>jdk11-deps</id>
-            <activation>
-                <jdk>[11,)</jdk>
-            </activation>
-            <dependencies>
-                <dependency>
-                    <groupId>com.sun.xml.bind</groupId>
-                    <artifactId>jaxb-impl</artifactId>
-                </dependency>
-                <dependency>
-                    <groupId>javax.xml.bind</groupId>
-                    <artifactId>jaxb-api</artifactId>
-                </dependency>
-            </dependencies>
-        </profile>
-    </profiles>
 </project>
diff --git a/naked-objects/dom/pom.xml b/naked-objects/dom/pom.xml
index 039afc373727..e816c76bbd78 100644
--- a/naked-objects/dom/pom.xml
+++ b/naked-objects/dom/pom.xml
@@ -36,6 +36,17 @@
 				</excludes>
 			</resource>
 		</resources>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>${compiler.version}</version>
+				<configuration>
+					<source>8</source>
+					<target>8</target>
+				</configuration>
+			</plugin>
+		</plugins>
 	</build>
 
 	<dependencies>
diff --git a/naked-objects/integtests/pom.xml b/naked-objects/integtests/pom.xml
index f12f4ae1e368..7365a71a9acb 100644
--- a/naked-objects/integtests/pom.xml
+++ b/naked-objects/integtests/pom.xml
@@ -90,6 +90,11 @@
 			<artifactId>hsqldb</artifactId>
 		</dependency>
 
+		<dependency>
+			<groupId>javax.annotation</groupId>
+			<artifactId>javax.annotation-api</artifactId>
+		</dependency>
+
         <!-- 
         uncomment to enable enhanced cucumber-jvm reporting
         http://www.masterthought.net/section/cucumber-reporting
@@ -122,20 +127,5 @@
         </repository>  
     </repositories>  
      -->
-	<profiles>
-		<profile>
-			<id>jdk11-deps</id>
-			<activation>
-				<jdk>[11,)</jdk>
-			</activation>
-			<dependencies>
-				<dependency>
-					<groupId>javax.annotation</groupId>
-					<artifactId>javax.annotation-api</artifactId>
-				</dependency>
-			</dependencies>
-		</profile>
-	</profiles>
-
 
 </project>
diff --git a/pom.xml b/pom.xml
index efeee185c788..b3756e1c06fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -58,7 +58,7 @@
         <log4j.version>1.2.17</log4j.version>
         <jaxb-api.version>2.3.1</jaxb-api.version>
         <jaxb-impl.version>2.3.2</jaxb-impl.version>
-        <annotation-api.version>1.3.1</annotation-api.version>
+        <annotation-api.version>1.3.2</annotation-api.version>
     </properties>
     <modules>
         <module>abstract-factory</module>
@@ -320,6 +320,11 @@
                 <artifactId>jaxb-impl</artifactId>
                 <version>${jaxb-impl.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.javassist</groupId>
+                <artifactId>javassist</artifactId>
+                <version>3.25.0-GA</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 
@@ -380,8 +385,8 @@
                     <artifactId>maven-compiler-plugin</artifactId>
                     <version>${compiler.version}</version>
                     <configuration>
-                        <source>1.8</source>
-                        <target>1.8</target>
+                        <source>11</source>
+                        <target>11</target>
                     </configuration>
                 </plugin>
                 <plugin>
@@ -500,27 +505,4 @@
         </plugins>
     </reporting>
 
-    <profiles>
-        <profile>
-            <id>jdk11-dep-management</id>
-            <activation>
-                <jdk>[11,)</jdk>
-            </activation>
-            <dependencyManagement>
-	            <dependencies>
-	                <dependency>
-	                    <groupId>org.javassist</groupId>
-	                    <artifactId>javassist</artifactId>
-	                    <version>3.25.0-GA</version>
-	                </dependency>
-	                <dependency>
-	                    <groupId>javax.annotation</groupId>
-	                    <artifactId>javax.annotation-api</artifactId>
-	                    <version>1.3.2</version>
-	                </dependency>
-	            </dependencies>
-            </dependencyManagement>
-        </profile>
-    </profiles>
-
 </project>
diff --git a/service-layer/pom.xml b/service-layer/pom.xml
index 4edd950740a8..057a701341a7 100644
--- a/service-layer/pom.xml
+++ b/service-layer/pom.xml
@@ -41,6 +41,14 @@
 		<groupId>com.h2database</groupId>
 		<artifactId>h2</artifactId>
 	</dependency>
+    <dependency>
+        <groupId>com.sun.xml.bind</groupId>
+        <artifactId>jaxb-impl</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>javax.xml.bind</groupId>
+        <artifactId>jaxb-api</artifactId>
+    </dependency>
     <dependency>
         <groupId>org.junit.jupiter</groupId>
         <artifactId>junit-jupiter-engine</artifactId>
@@ -52,22 +60,5 @@
       <scope>test</scope>
     </dependency>
   </dependencies>
-  <profiles>
-      <profile>
-          <id>jdk11-deps</id>
-          <activation>
-              <jdk>[11,)</jdk>
-          </activation>
-          <dependencies>
-              <dependency>
-                  <groupId>com.sun.xml.bind</groupId>
-                  <artifactId>jaxb-impl</artifactId>
-              </dependency>
-              <dependency>
-                  <groupId>javax.xml.bind</groupId>
-                  <artifactId>jaxb-api</artifactId>
-              </dependency>
-          </dependencies>
-      </profile>
-  </profiles>
+
 </project>


Test patch: