Skip to content

Commit

Permalink
Add Grails mail 4.0.0 plugin support. (#8)
Browse files Browse the repository at this point in the history
* Add Grails mail 4.0.0 plugin support. Move AsynchronousMailService.groovy to src folder to save it from SendMail trait enrich.

* Fix failing test case due to metaclass methods access etc.
  • Loading branch information
vsachinv authored Dec 3, 2024
1 parent becdd80 commit 21d2e9b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ Installation

To install just add the plugin to the plugins block of `build.gradle`:

For Grails 6.x.x
```groovy
implementation "io.github.gpc:asynchronous-mail:4.0.0-SNAPSHOT"
```


For Grails 5.x.x
```groovy
implementation "io.github.gpc:asynchronous-mail:3.1.2"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies {
implementation 'org.grails.plugins:hibernate5'
implementation 'org.hibernate:hibernate-core:5.6.15.Final'
implementation 'org.grails.plugins:gsp'
implementation 'org.grails.plugins:mail:3.0.0'
implementation 'org.grails.plugins:mail:4.0.0'
// This is needed for the quartz-plugin on grails >= 4.0.x, https://github.com/grails-plugins/grails-quartz/issues/107#issuecomment-575951471
implementation('org.quartz-scheduler:quartz:2.3.2') { exclude group: 'slf4j-api', module: 'c3p0' }
implementation 'org.grails.plugins:quartz:2.0.13'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import org.quartz.TriggerKey
class AsynchronousMailGrailsPlugin extends Plugin {

def grailsVersion = "6.0.0 > *"
def dependsOn = [mail: "* > 4.0.0"]
def loadAfter = ['mail', 'quartz', 'hibernate', 'hibernate3', 'hibernate4', 'hibernate5', 'mongodb']

@Override
Closure doWithSpring() {
{ ->
//noinspection GrUnresolvedAccess
asynchronousMailMessageBuilderFactory(AsynchronousMailMessageBuilderFactory) { it.autowire = true }
asynchronousMailService(AsynchronousMailService) { it.autowire = true }
//noinspection GrUnresolvedAccess
springConfig.addAlias 'asyncMailService', 'asynchronousMailService'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CompareMessageBuilderSpec extends Specification {

// Remove these methods as they are not part of MailMessageBuilder api and has found to be missing from
// AsynchronousMailMessageBuilder with some versions of groovy which will make the test fail
mbMethods.removeAll { ['getProperty', 'setProperty', 'invokeMethod'].contains(it.name) }
mbMethods.removeAll { ['getProperty', 'setProperty', 'invokeMethod', 'access$0', 'pfaccess$0', 'pfaccess$1'].contains(it.name) }

expect:
mbMethods.every { MetaMethod mbm ->
Expand Down

0 comments on commit 21d2e9b

Please sign in to comment.