Repository: iluwatar/java-design-patterns
Issue: Java 11 support: Modules
Labels: info: help wanted
type: support
epic: design

This task is part of the Java 11 transition plan https://github.com/iluwatar/java-design-patterns/wiki/16.-Java-11-Transition

Java 9 introduces the Java Platform Module System. How should it be utilized in this project? In this task we create a plan what kind of modules are going to be created. Would it be possible to start without modules i.e. let everything belong to the default 'unnamed' module? And then later on possibly create module per pattern.

Links:
https://blog.codefx.org/java/java-9-migration-guide/
https://www.baeldung.com/java-9-modularity


Issue comments:
Currently all the patterns belong to the unnamed module since they have not been modularized. The next step would be to add `module-info.java` to each of the patterns to make them real modules.

Pull request review comments:

Patch that resolved the issue:
diff --git a/.travis.yml b/.travis.yml
index 58edddeb416e..474732c166b3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,7 @@
 language: java
 dist: trusty   # Xenial build environment won't allow installation of Java 8
 jdk:
-- oraclejdk8
+- openjdk11
 
 env:
   global:
@@ -21,12 +21,6 @@ after_success:
 - mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN
 - bash update-ghpages.sh
 
-# use latest java version available instead of travis default
-addons:
-  apt:
-    packages:
-      - oracle-java8-installer
-
 notifications:
   email:
     - iluwatar@gmail.com
diff --git a/exclude-pmd.properties b/exclude-pmd.properties
index 5a4bb138834e..c49916ca964d 100644
--- a/exclude-pmd.properties
+++ b/exclude-pmd.properties
@@ -24,4 +24,4 @@
 com.iluwatar.servicelayer.common.BaseEntity=UnusedPrivateField
 com.iluwatar.doublechecked.locking.App=EmptyStatementNotInLoop,EmptyWhileStmt
 com.iluwatar.doublechecked.locking.InventoryTest=EmptyStatementNotInLoop,EmptyWhileStmt
-domainapp.dom.modules.simple.QSimpleObject=UnusedFormalParameter
\ No newline at end of file
+domainapp.dom.modules.simple.QSimpleObject=UnusedFormalParameter,UnusedImports
\ No newline at end of file
diff --git a/naked-objects/dom/pom.xml b/naked-objects/dom/pom.xml
index 69365bd4b00a..83c18267c5a9 100644
--- a/naked-objects/dom/pom.xml
+++ b/naked-objects/dom/pom.xml
@@ -78,7 +78,7 @@
 				<activeByDefault>true</activeByDefault>
 			</activation>
 			<properties>
-                <datanucleus-maven-plugin.version>4.0.1</datanucleus-maven-plugin.version>
+                <datanucleus.version>5.2.1</datanucleus.version>
 			</properties>
 			<build>
 				<pluginManagement>
@@ -96,7 +96,7 @@
 											<pluginExecutionFilter>
 												<groupId>org.datanucleus</groupId>
 												<artifactId>datanucleus-maven-plugin</artifactId>
-												<versionRange>[${datanucleus-maven-plugin.version},)</versionRange>
+												<versionRange>[${datanucleus.version},)</versionRange>
 												<goals>
 													<goal>enhance</goal>
 												</goals>
@@ -115,12 +115,13 @@
 					<plugin>
 						<groupId>org.datanucleus</groupId>
 						<artifactId>datanucleus-maven-plugin</artifactId>
-						<version>${datanucleus-maven-plugin.version}</version>
+						<version>${datanucleus.version}</version>
 						<configuration>
+							<log4jConfiguration>log4j.properties</log4jConfiguration>
+							<persistenceUnitName>simple</persistenceUnitName>
+							<api>JDO</api>
 							<fork>false</fork>
-							<log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
 							<verbose>true</verbose>
-							<props>${basedir}/datanucleus.properties</props>
 						</configuration>
 						<executions>
 							<execution>
@@ -137,6 +138,7 @@
 				<dependency>
 					<groupId>org.datanucleus</groupId>
 					<artifactId>datanucleus-core</artifactId>
+					<version>${datanucleus.version}</version>
 				</dependency>
 				<dependency>
 					<groupId>org.datanucleus</groupId>
@@ -145,6 +147,7 @@
 				<dependency>
 					<groupId>org.datanucleus</groupId>
 					<artifactId>datanucleus-api-jdo</artifactId>
+					<version>${datanucleus.version}</version>
 				</dependency>
 			</dependencies>
 		</profile>
@@ -157,7 +160,7 @@
 					<plugin>
 						<groupId>org.apache.isis.tool</groupId>
 						<artifactId>isis-maven-plugin</artifactId>
-						<version>1.9.0-SNAPSHOT</version>
+						<version>${isis.version}</version>
 						<configuration>
 							<isisConfigDir>../webapp/src/main/webapp/WEB-INF</isisConfigDir>
 						</configuration>
@@ -165,7 +168,7 @@
 							<dependency>
 								<groupId>org.apache.isis.example.application</groupId>
 								<artifactId>simpleapp-dom</artifactId>
-								<version>1.9.0-SNAPSHOT</version>
+								<version>${isis.version}</version>
 							</dependency>
 							<!-- ... workaround to avoid conflict with plexus-default (not sure 
 								why exclusions in the isis-maven-plugin aren't sufficient, though ... -->
diff --git a/naked-objects/integtests/pom.xml b/naked-objects/integtests/pom.xml
index c4dd52dcf652..0d5940df556d 100644
--- a/naked-objects/integtests/pom.xml
+++ b/naked-objects/integtests/pom.xml
@@ -85,6 +85,11 @@
 			<scope>test</scope>
 		</dependency>
 
+		<dependency>
+			<groupId>javax.annotation</groupId>
+			<artifactId>javax.annotation-api</artifactId>
+		</dependency>
+
 		<dependency>
 			<groupId>org.hsqldb</groupId>
 			<artifactId>hsqldb</artifactId>
diff --git a/pom.xml b/pom.xml
index 539da396b2d8..1feafbd559ce 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,7 +56,7 @@
         <jackson.version>2.8.5</jackson.version>
         <pmd.version>3.12.0</pmd.version>
         <jaxb-api.version>2.3.0</jaxb-api.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>
@@ -329,6 +329,11 @@
             <artifactId>logback-core</artifactId>
             <version>${logback.version}</version>
         </dependency>
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+            <version>2.3.1</version>
+        </dependency>
     </dependencies>
 
     <build>
@@ -370,8 +375,7 @@
                     <artifactId>maven-compiler-plugin</artifactId>
                     <version>${compiler.version}</version>
                     <configuration>
-                        <source>1.8</source>
-                        <target>1.8</target>
+                        <release>11</release>
                     </configuration>
                 </plugin>
                 <plugin>


Test patch: