Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove mongo dependency & move json-templates to mongo repo #604

Merged
merged 1 commit into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@ repositories {
mavenCentral()
maven { url = 'https://repo.grails.org/grails/core' }

def gradleGrailsVersion = project.rootProject
.extensions
.getByType(VersionCatalogsExtension.class)
.named("buildsrcLibs")
.findVersion("grails-gradle-plugin")
.get()
.displayName
if (System.getenv("GITHUB_MAVEN_PASSWORD") && !gradleGrailsVersion.endsWith('-SNAPSHOT')) {
if (System.getenv("GITHUB_MAVEN_PASSWORD")) {
System.out.println("Adding Grails Core Repo")
maven {
url = 'https://maven.pkg.github.com/grails/grails-core'
Expand Down
5 changes: 0 additions & 5 deletions docs/src/docs/asciidoc/json/installation.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ To activate JSON views, add the following dependency to the `dependencies` block
[source,groovy,subs="attributes"]
compile "org.grails.plugins:views-json:{version}"

If you are also using MongoDB you may want to add the `views-json-templates` dependency too which includes support for GeoJSON:

[source,groovy,subs="attributes"]
compile "org.grails.plugins:views-json-templates:{version}"

To enable Gradle compilation of JSON views for production environment add the following to the `buildscript` `dependencies` block:

[source,groovy,subs="attributes"]
Expand Down
2 changes: 0 additions & 2 deletions docs/src/docs/asciidoc/json/pluginSupport.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ Once this is in place any applications that includes this library will have acce

For example if you want to render all instances of type `foo.bar.Birthday` create a template called `src/main/gson/foo/bar/_birthday.gson` then compile the template and place the JAR on the classpath of your application.

NOTE: See the https://github.com/grails/grails-views/tree/master/json-templates/src/templates/grails/mongodb/geo[GeoJSON templates] for MongoDB for example of how it provides global templates for Mongo specific classes.

== Customizing the Compile Task

Unless otherwise configured, the project name of the plugin (the gradle `project.name`) is used as the `packageName` when compiling JSON views.
Expand Down
2 changes: 0 additions & 2 deletions examples/functional-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ dependencies {

implementation 'org.grails.plugins:gsp'
implementation 'org.grails.plugins:hibernate5'
implementation libs.grails.datastore.gorm.mongodb // Only used for access to grails.mongodb.geo.Point class

implementation 'org.springframework.boot:spring-boot-autoconfigure'
implementation 'org.springframework.boot:spring-boot-starter-logging'
implementation 'org.springframework.boot:spring-boot-starter-tomcat'

compileOnly libs.jakarta.servlet.api // Provided by Tomcat

runtimeOnly project(':views-json-templates')
runtimeOnly 'com.h2database:h2'
runtimeOnly 'org.apache.tomcat:tomcat-jdbc'
runtimeOnly libs.assetpipeline
Expand Down
4 changes: 0 additions & 4 deletions examples/functional-tests/grails-app/conf/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ spring:
groovy:
template:
check-template-location: false
autoconfigure:
exclude:
# No need to start MongoDB, we only need access to the Point class from gorm-mongodb
- org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration
---
grails:
mime:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
package functional.tests

import grails.mongodb.geo.Point

/**
* Created by graemerocher on 19/05/16.
*/
class PlaceController {

static responseFormats = ['json']

def show() {
respond new Place(name: "London", location: Point.valueOf(10,10))
}

def test() {
respond new Place(name: "London", location: Point.valueOf(10,10))
respond new Place(name: "London", location: "UK")
}
}

class Place {
String name
Point location
String location
}
8 changes: 0 additions & 8 deletions examples/functional-tests/grails-app/views/place/show.gson

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ class ObjectTemplateSpec extends HttpClientSpec {

then:"The correct response is returned"
rsp.status() == HttpStatus.OK
rsp.body() == '{"location":{"type":"Point","coordinates":[10.0,10.0]},"name":"London"}'
rsp.body() == '{"location":"UK","name":"London"}'
}
}
2 changes: 0 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ grails-bootstrap = { module = 'org.grails:grails-bootstrap' }
grails-core = { module = 'org.grails:grails-core' }
grails-datastore-core = { module = 'org.grails:grails-datastore-core' }
grails-datastore-gorm-hibernate5 = { module = 'org.grails:grails-datastore-gorm-hibernate5' }
grails-datastore-gorm-mongodb = { module = 'org.grails:grails-datastore-gorm-mongodb' }
grails-datastore-gorm-support = { module = 'org.grails:grails-datastore-gorm-support' }
grails-encoder = { module = 'org.grails:grails-encoder' }
grails-gradle-plugin = { module = 'org.grails:grails-gradle-plugin', version.ref = 'grails-gradle-plugin' }
Expand All @@ -32,7 +31,6 @@ jakarta-servlet-api = { module = 'jakarta.servlet:jakarta.servlet-api' }
jakarta-validation-api = { module = 'jakarta.validation:jakarta.validation-api' }
micronaut-jackson-databind = { module = 'io.micronaut:micronaut-jackson-databind', version.ref = 'micronaut' }
micronaut-http-client = { module = 'io.micronaut:micronaut-http-client', version.ref = 'micronaut' }
mongodb-bson = { module = 'org.mongodb:bson' }
slf4j-api = { module = 'org.slf4j:slf4j-api' }
slf4j-nop = { module = 'org.slf4j:slf4j-nop' }
spock-core = { module = 'org.spockframework:spock-core' }
Expand Down
59 changes: 0 additions & 59 deletions json-templates/build.gradle

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions json-templates/src/templates/grails/mongodb/geo/_lineString.gson

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions json-templates/src/templates/grails/mongodb/geo/_multiPoint.gson

This file was deleted.

12 changes: 0 additions & 12 deletions json-templates/src/templates/grails/mongodb/geo/_multiPolygon.gson

This file was deleted.

12 changes: 0 additions & 12 deletions json-templates/src/templates/grails/mongodb/geo/_point.gson

This file was deleted.

12 changes: 0 additions & 12 deletions json-templates/src/templates/grails/mongodb/geo/_polygon.gson

This file was deleted.

8 changes: 0 additions & 8 deletions json-templates/src/templates/org/bson/types/_objectId.gson

This file was deleted.

2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencyResolutionManagement {
}
}

['core', 'json', 'docs', 'json-templates', 'json-testing-support', 'markup'].each {dirName ->
['core', 'json', 'docs', 'json-testing-support', 'markup'].each {dirName ->
include("views-$dirName")
project(":views-$dirName").projectDir = file(dirName)
}
Expand Down
Loading