Skip to content

Commit aa292a6

Browse files
author
scott bortman
committed
upgraded to Grails 6 using omar-foobar template
1 parent cf66fee commit aa292a6

File tree

90 files changed

+42909
-704
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+42909
-704
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Thumbs.db
22
.DS_Store
33
.gradle
44
build/
5+
target/
56
out/
67
.idea
78
*.iml
@@ -10,4 +11,6 @@ out/
1011
.project
1112
.settings
1213
.classpath
14+
.factorypath
15+
values-dev.yaml
1316
prodDb.mv.db

build.gradle

Lines changed: 111 additions & 240 deletions
Original file line numberDiff line numberDiff line change
@@ -1,254 +1,125 @@
1-
buildscript {
2-
repositories {
3-
maven { url ossimMavenProxy }
4-
maven { url "https://repo.grails.org/grails/core" }
5-
}
6-
dependencies {
7-
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
8-
classpath "org.grails.plugins:hibernate5:${hibernate5PluginVersion}"
9-
classpath "gradle.plugin.com.github.erdi.webdriver-binaries:webdriver-binaries-gradle-plugin:${webdriverGradlePluginVersion}"
10-
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:${assetPipelineVersion}"
11-
}
12-
}
13-
141
plugins {
15-
id 'groovy'
16-
id "com.github.ben-manes.versions" version "0.36.0"
17-
id "org.sonarqube" version "3.1"
2+
id "com.github.erdi.webdriver-binaries" version "${ webdriverPluginVersion }" apply false
3+
id "com.github.ben-manes.versions" version "${ versionsPluginVersion }"
4+
id 'com.google.cloud.tools.jib' version "${ jibPluginVersion }" apply false
185
}
196

207
subprojects { project ->
21-
boolean isGrailsApp = project.name.endsWith( '-app' )
22-
boolean isGrailsPlugin = project.name.endsWith( '-plugin' )
23-
boolean isGrailsProject = isGrailsApp || isGrailsPlugin
24-
25-
project.ext {
26-
gitBranch = getCurrentGitBranch(project)
27-
gitBranch = gitBranch == "HEAD" ? branchName : gitBranch
28-
buildVersionTag = gitBranch == "master" ? "RELEASE" : "SNAPSHOT"
8+
boolean isGrailsApp = project.name.endsWith( '-app' )
9+
boolean isGrailsPlugin = project.name.endsWith( '-plugin' )
10+
boolean isGrailsProject = isGrailsApp || isGrailsPlugin
11+
12+
apply plugin: 'groovy'
13+
apply plugin: 'idea'
14+
apply plugin: 'eclipse'
15+
16+
version projectVersion
17+
group = groupName
18+
19+
repositories {
20+
mavenLocal()
21+
maven { url 'https://repo.osgeo.org/repository/release/' }
22+
mavenCentral()
23+
maven { url "https://repo.grails.org/grails/core/" }
24+
}
25+
26+
if ( isGrailsProject ) {
27+
apply plugin: 'application'
28+
apply plugin: 'org.grails.grails-gsp'
29+
apply plugin: 'org.grails.grails-web'
30+
apply plugin: 'com.bertramlabs.asset-pipeline'
31+
32+
if ( isGrailsApp ) {
33+
apply plugin: 'com.github.erdi.webdriver-binaries'
34+
} else if ( isGrailsPlugin ) {
35+
apply plugin: 'org.grails.grails-plugin'
2936
}
3037

31-
project.version "${project.buildVersion}-${buildVersionTag}"
32-
project.group groupName
33-
34-
apply plugin:"eclipse"
35-
apply plugin:"idea"
36-
37-
if ( isGrailsProject )
38-
{
39-
if ( isGrailsApp )
40-
{
41-
ext {
42-
dockerBuildDir = "${ rootProject.projectDir }/docker"
43-
jarDestination = "${ project.projectDir }/build/libs/${ project.name }-${ version }.jar"
44-
}
45-
46-
// Copy the built jar to the docker directory
47-
task copyJarToDockerDir( type: Copy ) {
48-
doFirst {
49-
println "Copying ${ jarDestination } to ${ dockerBuildDir }"
50-
}
51-
from jarDestination
52-
into dockerBuildDir
53-
}
54-
55-
apply plugin:"org.grails.grails-web"
56-
apply plugin:"com.github.erdi.webdriver-binaries"
57-
}
58-
else if ( isGrailsPlugin )
59-
{
60-
apply plugin:"org.grails.grails-plugin"
61-
apply plugin:"org.grails.grails-plugin-publish"
62-
63-
ext {
64-
jarDestination = "${project.projectDir}/build/libs/${project.name}-${version}.jar"
65-
mavenPublishUrl = getConfigurationProperty( 'MAVEN_UPLOAD_URL', 'mavenPublishUrl' )
66-
mavenRepoUsername = getConfigurationProperty( 'MAVEN_REPO_USERNAME', 'mavenRepoUsername')
67-
mavenRepoPassword = getConfigurationProperty( 'MAVEN_REPO_PASSWORD', 'mavenRepoPassword')
68-
}
69-
70-
project.with {
71-
publishing {
72-
publications {
73-
"${project.name}" (MavenPublication) {
74-
group "${groupName}-${buildVersionTag}"
75-
groupId = "${groupName}-${buildVersionTag}"
76-
version project.version
77-
from components.java
78-
}
79-
}
80-
repositories {
81-
maven {
82-
credentials {
83-
username mavenRepoUsername
84-
password mavenRepoPassword
85-
}
86-
url = mavenPublishUrl.toLowerCase()
87-
}
88-
}
89-
jar.onlyIf {
90-
!file(jarDestination).exists()
91-
}
92-
}
38+
configurations {
39+
all {
40+
resolutionStrategy.force "org.codehaus.groovy:groovy-xml:${ groovyVersion }"
41+
if ( isGrailsApp ) {
42+
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
43+
if ( details.requested.group == 'org.seleniumhq.selenium' ) {
44+
details.useVersion( seleniumVersion )
9345
}
46+
}
9447
}
48+
}
49+
}
9550

96-
apply plugin:"asset-pipeline"
97-
apply plugin:"org.grails.grails-gsp"
98-
99-
repositories {
100-
mavenLocal()
101-
maven { url ossimMavenProxy }
102-
maven { url "https://repo.grails.org/grails/core" }
103-
}
104-
105-
configurations {
106-
developmentOnly
107-
runtimeClasspath {
108-
extendsFrom developmentOnly
109-
}
110-
}
111-
112-
if ( isGrailsApp )
113-
{
114-
dependencyManagement {
115-
imports {
116-
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
117-
}
118-
}
119-
}
120-
121-
dependencies {
122-
developmentOnly("org.springframework.boot:spring-boot-devtools")
123-
compile "org.springframework.boot:spring-boot-starter-logging"
124-
compile "org.springframework.boot:spring-boot-autoconfigure"
125-
compile "org.grails:grails-core"
126-
compile "org.springframework.boot:spring-boot-starter-actuator"
127-
compile "org.springframework.boot:spring-boot-starter-tomcat"
128-
compile "org.grails:grails-web-boot"
129-
compile "org.grails:grails-logging"
130-
compile "org.grails:grails-plugin-rest"
131-
compile "org.grails:grails-plugin-databinding"
132-
compile "org.grails:grails-plugin-i18n"
133-
compile "org.grails:grails-plugin-services"
134-
compile "org.grails:grails-plugin-url-mappings"
135-
compile "org.grails:grails-plugin-interceptors"
136-
compile "org.grails.plugins:cache"
137-
compile "org.grails.plugins:async"
138-
compile "org.grails.plugins:scaffolding"
139-
compile "org.grails.plugins:gsp"
140-
compileOnly "io.micronaut:micronaut-inject-groovy"
141-
console "org.grails:grails-console"
142-
runtime "com.bertramlabs.plugins:asset-pipeline-grails:${assetPipelineVersion}"
143-
testCompile "org.grails:grails-gorm-testing-support"
144-
testCompile "org.mockito:mockito-core"
145-
testCompile "org.grails:grails-web-testing-support"
146-
147-
compile "org.apache.logging.log4j:log4j-to-slf4j:2.17.1"
148-
compile "org.apache.logging.log4j:log4j-api:2.17.1"
149-
compile "ch.qos.logback:logback-classic:1.2.10"
150-
compile "ch.qos.logback:logback-core:1.2.10"
151-
152-
if ( isGrailsApp )
153-
{
154-
compile "org.grails.plugins:events"
155-
compile "org.grails.plugins:hibernate5"
156-
compile "org.hibernate:hibernate-core:${hibernateCoreVersion}"
157-
profile "org.grails.profiles:web"
158-
runtime "org.glassfish.web:el-impl:${glassfishWebVersion}"
159-
runtime "com.h2database:h2"
160-
runtime "org.apache.tomcat:tomcat-jdbc"
161-
runtime "javax.xml.bind:jaxb-api:${jaxbApiVersion}"
162-
testCompile "org.grails.plugins:geb"
163-
testCompile "org.seleniumhq.selenium:selenium-remote-driver:${seleniumVersion}"
164-
testCompile "org.seleniumhq.selenium:selenium-api:${seleniumVersion}"
165-
testCompile "org.seleniumhq.selenium:selenium-support:${seleniumVersion}"
166-
testRuntime "org.seleniumhq.selenium:selenium-chrome-driver:${seleniumVersion}"
167-
testRuntime "org.seleniumhq.selenium:selenium-firefox-driver:${seleniumVersion}"
168-
169-
compile 'org.springframework.cloud:spring-cloud-starter-config'
170-
compile "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client"
171-
}
172-
else if ( isGrailsPlugin )
173-
{
174-
profile "org.grails.profiles:web-plugin"
175-
testCompile "org.grails:grails-plugin-testing"
176-
}
177-
}
178-
179-
bootRun {
180-
jvmArgs(
181-
'-Dspring.output.ansi.enabled=always',
182-
'-noverify',
183-
'-XX:TieredStopAtLevel=1',
184-
'-Xmx1024m')
185-
sourceResources sourceSets.main
186-
String springProfilesActive = 'spring.profiles.active'
187-
systemProperty springProfilesActive, System.getProperty(springProfilesActive)
188-
}
189-
190-
if ( isGrailsApp )
191-
{
192-
webdriverBinaries {
193-
chromedriver '2.45.0'
194-
geckodriver '0.24.0'
195-
}
51+
dependencies {
52+
developmentOnly("org.springframework.boot:spring-boot-devtools")
53+
implementation( "org.grails:grails-core" )
54+
implementation( "org.grails:grails-logging" )
55+
implementation( "org.grails:grails-plugin-databinding" )
56+
implementation( "org.grails:grails-plugin-i18n" )
57+
implementation( "org.grails:grails-plugin-interceptors" )
58+
implementation( "org.grails:grails-plugin-rest" )
59+
implementation( "org.grails:grails-plugin-services" )
60+
implementation( "org.grails:grails-plugin-url-mappings" )
61+
implementation( "org.grails:grails-web-boot" )
62+
implementation( "org.grails.plugins:gsp" )
63+
implementation( "org.grails.plugins:hibernate5" )
64+
implementation( "org.grails.plugins:scaffolding" )
65+
implementation( "org.hibernate:hibernate-core:${ hibernateCoreVersion }" )
66+
implementation( "org.springframework.boot:spring-boot-autoconfigure" )
67+
implementation( "org.springframework.boot:spring-boot-starter" )
68+
implementation( "org.springframework.boot:spring-boot-starter-actuator" )
69+
implementation( "org.springframework.boot:spring-boot-starter-logging" )
70+
implementation( "org.springframework.boot:spring-boot-starter-tomcat" )
71+
implementation( "org.springframework.boot:spring-boot-starter-validation" )
72+
compileOnly( "io.micronaut:micronaut-inject-groovy" )
73+
runtimeOnly( "com.bertramlabs.plugins:asset-pipeline-grails:${ assetPipelineVersion }" )
74+
runtimeOnly( "com.h2database:h2" )
75+
runtimeOnly( "javax.xml.bind:jaxb-api:${ jaxbVersion }" )
76+
runtimeOnly( "org.apache.tomcat:tomcat-jdbc" )
77+
runtimeOnly( "org.fusesource.jansi:jansi:${ jansiVersion }" )
78+
runtimeOnly( "org.glassfish.web:el-impl:${ glassfishVersion }" )
79+
testImplementation( "io.micronaut:micronaut-inject-groovy" )
80+
testImplementation( "org.grails:grails-gorm-testing-support" )
81+
testImplementation( "org.grails:grails-web-testing-support" )
82+
testImplementation( "org.spockframework:spock-core" )
83+
testImplementation( "io.micronaut:micronaut-http-client" )
84+
console( "org.grails:grails-console" )
85+
86+
if ( isGrailsApp ) {
87+
testImplementation( "org.grails.plugins:geb" )
88+
testImplementation( "org.seleniumhq.selenium:selenium-api:${ seleniumVersion }" )
89+
testImplementation( "org.seleniumhq.selenium:selenium-remote-driver:${ seleniumVersion }" )
90+
testImplementation( "org.seleniumhq.selenium:selenium-support:${ seleniumVersion }" )
91+
testRuntimeOnly( "org.seleniumhq.selenium:selenium-chrome-driver:${ seleniumVersion }" )
92+
testRuntimeOnly( "org.seleniumhq.selenium:selenium-firefox-driver:${ seleniumVersion }" )
93+
testRuntimeOnly( "org.seleniumhq.selenium:selenium-safari-driver:${ seleniumVersion }" )
94+
} else if ( isGrailsPlugin ) {
95+
}
96+
}
19697

197-
tasks.withType(Test) {
198-
systemProperty "geb.env", System.getProperty('geb.env')
199-
systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest")
200-
systemProperty "webdriver.chrome.driver", System.getProperty('webdriver.chrome.driver')
201-
systemProperty "webdriver.gecko.driver", System.getProperty('webdriver.gecko.driver')
202-
}
203-
}
204-
else if ( isGrailsPlugin )
205-
{
206-
// enable if you wish to package this plugin as a standalone application
207-
bootJar.enabled = false
208-
grailsPublish {
209-
// TODO: Provide values here
210-
user = 'user'
211-
key = 'key'
212-
githubSlug = 'foo/bar'
213-
license {
214-
name = 'Apache-2.0'
215-
}
216-
title = "My Plugin"
217-
desc = "Full plugin description"
218-
developers = [johndoe:"John Doe"]
219-
}
220-
}
98+
application {
99+
mainClass.set( "${ project.name.replace( '-', '.' ) }.Application" )
100+
}
221101

222-
assets {
223-
if ( isGrailsApp )
224-
{
225-
minifyJs = true
226-
minifyCss = true
227-
}
228-
else if ( isGrailsPlugin )
229-
{
230-
packagePlugin = true
231-
}
232-
}
233-
}
234-
}
102+
java {
103+
sourceCompatibility = JavaVersion.toVersion( "17" )
104+
}
235105

236-
String getConfigurationProperty( String envVar, String sysProp )
237-
{
238-
System.getenv( envVar ) ?: project.findProperty( sysProp )
239-
}
106+
tasks.withType( Test ) {
107+
useJUnitPlatform()
108+
if ( isGrailsApp ) {
109+
systemProperty "geb.env", System.getProperty( 'geb.env' )
110+
systemProperty "geb.build.reportsDir", reporting.file( "geb/integrationTest" )
111+
systemProperty 'webdriver.chrome.driver', "${ System.getenv( 'CHROMEWEBDRIVER' ) }/chromedriver"
112+
systemProperty 'webdriver.gecko.driver', "${ System.getenv( 'GECKOWEBDRIVER' ) }/geckodriver"
113+
}
114+
}
240115

241-
String getCurrentGitBranch(Project project) {
242-
def gitBranch = "Unknown branch"
243-
try {
244-
def workingDir = new File("${project.projectDir}")
245-
def result = 'git rev-parse --abbrev-ref HEAD'.execute(null, workingDir)
246-
result.waitFor()
247-
if (result.exitValue() == 0) {
248-
gitBranch = result.text.trim()
249-
}
250-
} catch (e) {
251-
e.printStackTrace()
116+
if ( isGrailsApp ) {
117+
webdriverBinaries {
118+
chromedriver webdriverChromeVersion
119+
geckodriver webdriverGeckoVersion
120+
edgedriver webdriverEdgeVersion
121+
}
122+
} else if ( isGrailsPlugin ) {
252123
}
253-
return gitBranch
254-
}
124+
}
125+
}

buildSrc/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
repositories {
2+
mavenCentral()
3+
maven { url "https://repo.grails.org/grails/core/" }
4+
}
5+
dependencies {
6+
implementation("com.bertramlabs.plugins:asset-pipeline-gradle:4.3.0")
7+
implementation("org.grails:grails-gradle-plugin:6.0.0")
8+
implementation("org.grails.plugins:hibernate5:8.0.0")
9+
}

0 commit comments

Comments
 (0)