Skip to content

Commit 21d2e9b

Browse files
authored
Add Grails mail 4.0.0 plugin support. (#8)
* 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.
1 parent becdd80 commit 21d2e9b

File tree

5 files changed

+10
-2
lines changed

5 files changed

+10
-2
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ Installation
2525

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

28+
For Grails 6.x.x
29+
```groovy
30+
implementation "io.github.gpc:asynchronous-mail:4.0.0-SNAPSHOT"
31+
```
32+
33+
2834
For Grails 5.x.x
2935
```groovy
3036
implementation "io.github.gpc:asynchronous-mail:3.1.2"

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ dependencies {
3535
implementation 'org.grails.plugins:hibernate5'
3636
implementation 'org.hibernate:hibernate-core:5.6.15.Final'
3737
implementation 'org.grails.plugins:gsp'
38-
implementation 'org.grails.plugins:mail:3.0.0'
38+
implementation 'org.grails.plugins:mail:4.0.0'
3939
// This is needed for the quartz-plugin on grails >= 4.0.x, https://github.com/grails-plugins/grails-quartz/issues/107#issuecomment-575951471
4040
implementation('org.quartz-scheduler:quartz:2.3.2') { exclude group: 'slf4j-api', module: 'c3p0' }
4141
implementation 'org.grails.plugins:quartz:2.0.13'

src/main/groovy/grails/plugin/asyncmail/AsynchronousMailGrailsPlugin.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ import org.quartz.TriggerKey
1313
class AsynchronousMailGrailsPlugin extends Plugin {
1414

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

1819
@Override
1920
Closure doWithSpring() {
2021
{ ->
2122
//noinspection GrUnresolvedAccess
2223
asynchronousMailMessageBuilderFactory(AsynchronousMailMessageBuilderFactory) { it.autowire = true }
24+
asynchronousMailService(AsynchronousMailService) { it.autowire = true }
2325
//noinspection GrUnresolvedAccess
2426
springConfig.addAlias 'asyncMailService', 'asynchronousMailService'
2527
}

src/test/groovy/grails/plugin/asyncmail/CompareMessageBuilderSpec.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class CompareMessageBuilderSpec extends Specification {
1515

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

2020
expect:
2121
mbMethods.every { MetaMethod mbm ->

0 commit comments

Comments
 (0)