|
| 1 | +# Play Framework and Apache Pekko Upgrade |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This repository has been upgraded from Play Framework 2.7.2 with Akka 2.5.22 to Play Framework 3.0.5 with Apache Pekko 1.0.3. |
| 6 | + |
| 7 | +## Why This Upgrade |
| 8 | + |
| 9 | +**License Compliance**: Akka changed from Apache 2.0 to Business Source License 1.1, requiring commercial licenses for production use. Apache Pekko maintains Apache 2.0 license. |
| 10 | + |
| 11 | +**Security**: Play 2.7.2 and Akka 2.5.22 no longer receive security updates. |
| 12 | + |
| 13 | +**Modernization**: Access to latest features and performance improvements. |
| 14 | + |
| 15 | +## Technology Stack Changes |
| 16 | + |
| 17 | +- Play Framework: 2.7.2 to 3.0.5 |
| 18 | +- Actor Framework: Akka 2.5.22 to Apache Pekko 1.0.2 |
| 19 | +- Scala: 2.12.11 to 2.13.12 |
| 20 | +- Guice: 3.0 to 5.1.0 |
| 21 | +- SLF4J: 1.6.1 to 2.0.13 |
| 22 | +- Logback: 1.2.3 to 1.4.14 |
| 23 | +- Jackson: 2.13.5 to 2.14.3 |
| 24 | +- Netty: 4.1.77.Final to 4.1.112.Final |
| 25 | + |
| 26 | +## Key Changes |
| 27 | + |
| 28 | +### Dependencies |
| 29 | + |
| 30 | +All Maven POM files updated with new versions. Play Framework groupId changed from com.typesafe.play to org.playframework. Scala library exclusions added to prevent version conflicts between Scala 2.12 and 2.13. |
| 31 | + |
| 32 | +### Source Code |
| 33 | + |
| 34 | +Akka imports migrated to Pekko across all Java files: |
| 35 | +- akka.actor.* to org.apache.pekko.actor.* |
| 36 | +- akka.pattern.* to org.apache.pekko.pattern.* |
| 37 | +- akka.routing.* to org.apache.pekko.routing.* |
| 38 | +- akka.util.* to org.apache.pekko.util.* |
| 39 | +- akka.testkit.* to org.apache.pekko.testkit.* |
| 40 | + |
| 41 | +Updated FutureConverters for Scala 2.13: |
| 42 | +- scala.compat.java8.FutureConverters to scala.jdk.javaapi.FutureConverters |
| 43 | +- toJava() to asJava() |
| 44 | + |
| 45 | +### Configuration |
| 46 | + |
| 47 | +application.conf files updated with Pekko namespaces: |
| 48 | +- akka {} to pekko {} |
| 49 | +- Actor system configurations migrated |
| 50 | +- Serialization bindings updated |
| 51 | +- Dispatcher references changed |
| 52 | + |
| 53 | + |
| 54 | +### Play 3.0 API Updates |
| 55 | + |
| 56 | +Play 3.0 removed the request() method and Http.Context. All controller methods now inject Http.Request as a parameter. |
| 57 | + |
| 58 | +Controller updates: |
| 59 | +- HealthController |
| 60 | +- NotificationController |
| 61 | +- NotificationTemplateController |
| 62 | +- LogController |
| 63 | +- BaseController helper methods |
| 64 | + |
| 65 | +Routes file updated with request injection for all endpoints. |
| 66 | + |
| 67 | +### Test Framework |
| 68 | + |
| 69 | +Test files updated: |
| 70 | +- Replaced JavaTestKit.duration() with java.time.Duration.ofSeconds() |
| 71 | +- Resolved Duration class ambiguity between java.time and scala.concurrent |
| 72 | +- Fixed import conflicts |
| 73 | + |
| 74 | +### Scala Version Conflicts |
| 75 | + |
| 76 | +Added exclusions to prevent Scala 2.12 transitive dependencies: |
| 77 | +- Excluded scala-library and scala-reflect from dependencies where needed |
| 78 | +- Explicitly declared scala-library 2.13.12 dependency |
| 79 | + |
| 80 | +## Build Instructions |
| 81 | + |
| 82 | +Build all modules: |
| 83 | +``` |
| 84 | +mvn clean install -Dmaven.test.skip=true |
| 85 | +``` |
| 86 | + |
| 87 | +Build with test compilation: |
| 88 | +``` |
| 89 | +mvn clean install -DskipTests |
| 90 | +``` |
| 91 | + |
| 92 | +Create distribution package: |
| 93 | +``` |
| 94 | +cd service |
| 95 | +mvn play2:dist |
| 96 | +``` |
| 97 | + |
| 98 | +## Migration Impact |
| 99 | + |
| 100 | +**Business Logic**: No changes to business logic or functionality |
| 101 | + |
| 102 | +**API Compatibility**: Maintained, as Pekko is API-compatible with Akka 2.6 |
| 103 | + |
| 104 | +**Code Changes**: Primarily package name updates from akka to pekko |
| 105 | + |
| 106 | +**License**: Now compliant with Apache 2.0 throughout the stack |
| 107 | + |
| 108 | +## Known Issues |
| 109 | + |
| 110 | +**Scala 2.12/2.13 Conflict**: If you encounter NoClassDefFoundError for scala.collection.GenMap, verify dependency tree to ensure no Scala 2.12 artifacts are present. Run mvn dependency:tree and add exclusions for any scala-library or scala-reflect with version 2.12. |
| 111 | + |
| 112 | +**PowerMock Tests**: PowerMock is incompatible with Java 9+ module system. Tests using PowerMock will need to be updated or JVM arguments added. |
| 113 | + |
| 114 | +## Verification Steps |
| 115 | + |
| 116 | +1. Clean compilation successful |
| 117 | +2. All modules build without errors |
| 118 | +3. Dependency tree verified for no Scala 2.12 conflicts |
| 119 | +4. Configuration files validated |
| 120 | +5. Routes file compiled successfully |
0 commit comments