Skip to content

Commit

Permalink
Merge pull request #387 from mkurz/play_jakarta
Browse files Browse the repository at this point in the history
Use Play milestone that switches to `jakarta.inject` + Guice 7
  • Loading branch information
mkurz authored Jan 27, 2025
2 parents 4cb814f + d098896 commit a78fc90
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 16 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Use the `@Inject` annotation on the constructor, service of your component or co
import play.api.libs.mailer._
import java.io.File
import org.apache.commons.mail2.jakarta.EmailAttachment
import javax.inject.Inject
import jakarta.inject.Inject

class MailerService @Inject() (mailerClient: MailerClient) {

Expand Down Expand Up @@ -209,7 +209,7 @@ For Java you can just create a simple MailerService and Inject the MailerClient
```java
import play.libs.mailer.Email;
import play.libs.mailer.MailerClient;
import javax.inject.Inject;
import jakarta.inject.Inject;
import java.io.File;
import org.apache.commons.mail.EmailAttachment;

Expand Down
12 changes: 10 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import com.typesafe.sbt.SbtScalariform._
import com.typesafe.tools.mima.core.IncompatibleMethTypeProblem
import com.typesafe.tools.mima.core.MissingTypesProblem
import com.typesafe.tools.mima.core.ProblemFilters
import scalariform.formatter.preferences._

ThisBuild / dynverVTagPrefix := false
Expand Down Expand Up @@ -33,6 +36,11 @@ lazy val commonSettings = Seq(
"-Xlint:unchecked",
"-Xlint:deprecation"
),

mimaBinaryIssueFilters ++= Seq(
ProblemFilters.exclude[IncompatibleMethTypeProblem]("play.api.libs.mailer.SMTPDynamicMailer.this"),
ProblemFilters.exclude[MissingTypesProblem]("play.api.libs.mailer.SMTPConfigurationProvider"),
),
)

val previousVersion: Option[String] = Some("11.0.0-M1")
Expand All @@ -42,7 +50,7 @@ lazy val `play-mailer` = (project in file("play-mailer"))
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
"javax.inject" % "javax.inject" % "1",
"jakarta.inject" % "jakarta.inject-api" % "2.0.1",
"com.typesafe" % "config" % "1.4.3",
"org.slf4j" % "slf4j-api" % "2.0.16",
"org.apache.commons" % "commons-email2-jakarta" % "2.0.0-M1",
Expand All @@ -58,7 +66,7 @@ lazy val `play-mailer-guice` = (project in file("play-mailer-guice"))
.dependsOn(`play-mailer`)
.settings(
libraryDependencies ++= Seq(
"com.google.inject" % "guice" % "6.0.0",
"com.google.inject" % "guice" % "7.0.0",
"org.playframework" %% "play" % Dependencies.PlayVersion % Test,
"org.playframework" %% "play-specs2" % Dependencies.PlayVersion % Test
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package play.api.libs.mailer

import javax.inject.Inject
import jakarta.inject.Inject

import org.slf4j.LoggerFactory

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package play.api.libs.mailer

import javax.inject.{ Inject, Provider }
import jakarta.inject.{ Inject, Provider }

import com.typesafe.config.Config

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package play.api.libs.mailer

import javax.inject.{ Inject, Provider }
import jakarta.inject.{ Inject, Provider }

class SMTPDynamicMailer @Inject() (smtpConfigurationProvider: Provider[SMTPConfiguration]) extends MailerClient {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package play.api.libs.mailer

import org.apache.commons.mail2.jakarta.{ HtmlEmail, MultiPartEmail }

import javax.inject.Inject
import jakarta.inject.Inject

class SMTPMailer @Inject() (smtpConfiguration: SMTPConfiguration) extends MailerClient {

Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ object Dependencies {
val Scala3 = "3.3.4"
val ScalaVersions = Seq(Scala213, Scala3)

val PlayVersion = sys.props.getOrElse("play.version", sys.env.getOrElse("PLAY_VERSION", "3.0.6"))
val PlayVersion = sys.props.getOrElse("play.version", sys.env.getOrElse("PLAY_VERSION", "3.1.0-M1"))
}
2 changes: 1 addition & 1 deletion samples/compile-timeDI/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ crossScalaVersions := Seq("2.13.16", "3.3.4")

libraryDependencies ++= Seq(
"org.playframework" %% "play-mailer" % version.value,
"org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test
"org.scalatestplus.play" %% "scalatestplus-play" % "8.0.0-M1" % Test
)

lazy val root = (project in file(".")).enablePlugins(PlayScala)
Expand Down
2 changes: 1 addition & 1 deletion samples/compile-timeDI/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
addSbtPlugin("org.playframework" % "sbt-plugin" % sys.env.getOrElse("PLAY_VERSION", "3.0.6"))
addSbtPlugin("org.playframework" % "sbt-plugin" % sys.env.getOrElse("PLAY_VERSION", "3.1.0-M1"))
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.1.0")
2 changes: 1 addition & 1 deletion samples/runtimeDI/app/controllers/ApplicationJava.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import play.mvc.Result;
import play.Environment;

import javax.inject.Inject;
import jakarta.inject.Inject;
import java.io.File;

public class ApplicationJava extends Controller {
Expand Down
2 changes: 1 addition & 1 deletion samples/runtimeDI/app/controllers/ApplicationScala.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package controllers

import java.io.File
import javax.inject.Inject
import jakarta.inject.Inject

import org.apache.commons.mail2.jakarta.EmailAttachment
import play.api.Environment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package controllers

import javax.inject.Provider
import jakarta.inject.Provider

import play.api.libs.mailer.SMTPConfiguration
import play.api.{Configuration, Environment}
Expand Down
2 changes: 1 addition & 1 deletion samples/runtimeDI/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ crossScalaVersions := Seq("2.13.16", "3.3.4")

libraryDependencies ++= Seq(
"org.playframework" %% "play-mailer-guice" % version.value,
"org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test
"org.scalatestplus.play" %% "scalatestplus-play" % "8.0.0-M1" % Test
)

lazy val root = (project in file(".")).enablePlugins(PlayJava)
Expand Down
2 changes: 1 addition & 1 deletion samples/runtimeDI/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
addSbtPlugin("org.playframework" % "sbt-plugin" % sys.env.getOrElse("PLAY_VERSION", "3.0.6"))
addSbtPlugin("org.playframework" % "sbt-plugin" % sys.env.getOrElse("PLAY_VERSION", "3.1.0-M1"))
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.1.0")

0 comments on commit a78fc90

Please sign in to comment.