Skip to content

Commit

Permalink
Merge pull request #11546 from grails/forceGroovyVersion
Browse files Browse the repository at this point in the history
Force Groovy version 3.0.3
  • Loading branch information
puneetbehl authored May 15, 2020
2 parents 30c6f36 + 7eaba1f commit bde0476
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ import org.gradle.api.Action
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.artifacts.*
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ConfigurationContainer
import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.DependencyResolveDetails
import org.gradle.api.file.FileCollection
import org.gradle.api.java.archives.Manifest
import org.gradle.api.plugins.ExtraPropertiesExtension
Expand Down Expand Up @@ -94,6 +97,8 @@ class GrailsGradlePlugin extends GroovyPlugin {

applyDefaultPlugins(project)

configureGroovy(project)

registerToolingModelBuilder(project, registry)

registerGrailsExtension(project)
Expand Down Expand Up @@ -208,6 +213,23 @@ class GrailsGradlePlugin extends GroovyPlugin {
}
}

@CompileStatic
protected void configureGroovy(Project project) {
final String groovyVersion = project.properties['groovyVersion']
if (groovyVersion) {
project.configurations.all({ Configuration configuration ->
configuration.resolutionStrategy.eachDependency({ DependencyResolveDetails details ->
String dependencyName = details.requested.name
String group = details.requested.group
if (group == 'org.codehaus.groovy' && dependencyName.startsWith('groovy')) {
details.useVersion(groovyVersion)
return
}
} as Action<DependencyResolveDetails>)
} as Action<Configuration>)
}
}

@CompileStatic
protected void configureSpringBootExtension(Project project) {
def springBoot = project.extensions.findByType(SpringBootExtension)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos
if(gormDep != null) {
variables['gorm.version'] = gormDep
}
String groovyDep = mpr.profileDependencyVersions.versionProperties.get('groovy.version')
if(groovyDep != null) {
variables['groovy.version'] = groovyDep
}
}

Path appFullDirectory = Paths.get(cmd.baseDir.path, appname)
Expand Down

0 comments on commit bde0476

Please sign in to comment.