Grails 3 Cookie plugin not found - grails

I want to use the Grails 3 Cookie plugin (http://plugins.grails.org/plugin/ctoestreich/cookie). In my build.gradle I have these entries here:
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
mavenCentral()
}
dependencies {
[...]
compile 'org.grails.plugins:grails-cookie:2.0.5'
[...]
}
But when running gradle build, he's got problems looking up that dependency:
> Could not resolve all dependencies for configuration ':runtime'.
> Could not find org.grails.plugins:grails-cookie:2.0.5.
Searched in the following locations:
file:/home/marp/.m2/repository/org/grails/plugins/grails-cookie/2.0.5/grails-cookie-2.0.5.pom
file:/home/marp/.m2/repository/org/grails/plugins/grails-cookie/2.0.5/grails-cookie-2.0.5.jar
https://repo.grails.org/grails/core/org/grails/plugins/grails-cookie/2.0.5/grails-cookie-2.0.5.pom
https://repo.grails.org/grails/core/org/grails/plugins/grails-cookie/2.0.5/grails-cookie-2.0.5.jar
https://repo1.maven.org/maven2/org/grails/plugins/grails-cookie/2.0.5/grails-cookie-2.0.5.pom
https://repo1.maven.org/maven2/org/grails/plugins/grails-cookie/2.0.5/grails-cookie-2.0.5.jar
Required by:
project :
Do I need to include an other maven repo? Or is the plugin just gone?

Instead compile 'org.grails.plugins:grails-cookie:2.0.5'
use compile 'org.grails.plugins:cookie:2.0.5'
also you can set cookie expiration configuration in application.yml file
Example-grails.plugins.cookie.cookieage.default: 43200
repo of dependency
Hope it helps you

According to this (at the time of writing), 2.0.3 appears to be the newest version on the repo.grails.org repo:
http://repo.grails.org/grails/core/org/grails/plugins/grails-cookie/
change your dependency to:
compile 'org.grails.plugins:cookie:2.0.3'

Related

info api not showing git info with gradle-git-properties plugin in grails 4 app

I am trying to get git commit details as part of "/actuator/info" api end point using the gradle-git-properties plugin by following https://guides.grails.org/adding-commit-info/guide/index.html guide but having no luck with it. Steps I followed:
"sdk install grails 4.0.8" //installing latest grails 4 version using sdkman
"sdk use grails 4.0.8" //making sure my current shell is using latest version as well
"grails create-app myapp --profile=rest-api" //creating a dummy app
"cd myapp" //change working dir to the new app
"git init" //initializing git
As per the guide I updated the build.gradle
buildscript {
repositories {
maven { url "https://repo.grails.org/grails/core" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "org.grails.plugins:hibernate5:7.0.4"
classpath "org.grails.plugins:views-gradle:2.0.2"
classpath "gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:2.2.0"
}
}
version "0.1"
group "myapp"
apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"org.grails.plugins.views-json"
apply plugin: "com.gorylenko.gradle-git-properties"
Also updated the application.yml file to enable actuator end points
management:
endpoints:
enabled-by-default: true
run the application using ./gradlew bootRun
I see that the git.properties file is correctly generated and placed under "build/resources/main" folder within the project folder.
But when I hit "http://localhost:8080/actuator/info" in browser, all I see is:
{"app":{"grailsVersion":"4.0.8","version":"0.1","name":"myapp"}}
But no git related info.
Raised the same issue here are well: https://github.com/n0mer/gradle-git-properties/issues/161
Solution has been provided by #virtualdogbert here : https://github.com/n0mer/gradle-git-properties/issues/161#issuecomment-936544990
Basically we have to set path to the git.properties file for dev env:
environments {
development{
spring.info.git.location='file:build/resources/main/git.properties'
}
}

Fail to resolve spring-security-ldap 2.0.1 into Grails 2.4.4

Please help! I had a problem installing spring-security-ldap 2.0.1 into my Grails 2.4.4.
My BuildConfig.groovy is like such:
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
mavenCentral()
mavenRepo "http://repo.spring.io/milestone"
mavenRepo "http://repo.grails.org/grails/repo"
}
dependencies {
compile "org.grails.plugins:spring-security-ldap:2.0.1"
}
And during resolve the following error is shown:
Error | Resolve error obtaining dependencies: Could not find artifact org.grails.plugins:spring-security-ldap:jar:2.0.1 in grailsCentral (https://repo.grails.org/grails/plugins)
It's not a connection/proxy issue cause other dependencies was resolved with no problem.
Anyway to resolve this? Any info/help much appreciated!
Please change dependency from
dependencies {
compile "org.grails.plugins:spring-security-ldap:2.0.1"
}
To
dependencies {
compile 'org.grails.plugins:spring-security-ldap:3.0.2'
}
You can check repo of grails core spring-security-ldap plugin.
Updated:
plugins {
compile ":spring-security-ldap:2.0.1"
}
Please refer this link to other configuration
Above uses Grails 2.X and likely won't work with 3.X
Hope this will helps you

Gradle giving ClassNotFoundException while building Grails project

I am trying to use the gradle-grails-plugin to build an existing (small) Grails project. Should this work? What is the relationship between the dependencies in build.gradle and the ones specified in buildConfig.groovy?
In any event, I have two projects, so the topmost build.gradle file is in the parent directory and looks like:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "org.grails:grails-gradle-plugin:2.2.0.RC1"
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
and then the build.gradle in the Grails project looks like:
apply plugin: "grails"
repositories {
grails.central() //creates a maven repo for the Grails Central repository (Core libraries and plugins)
}
grails {
grailsVersion = '2.4.4'
groovyVersion = '2.3.9'
springLoadedVersion '1.2.0.RELEASE'
}
dependencies {
bootstrap "org.grails.plugins:tomcat:7.0.55.3"
compile 'org.grails.plugins:asset-pipeline:3.0.1'
compile 'org.grails.plugins:scaffolding:2.1.2'
compile 'org.grails.plugins:cache:1.1.8'
runtime 'org.grails.plugins:hibernate4:4.3.1.1'
runtime 'org.grails.plugins:database-migration:1.3.8'
runtime 'org.grails.plugins:jquery:1.11.0'
}
However, when I run ./gradlew war, I get back:
Caused by: java.long.ClassNotFoundException: grails.artefact.Service
Can anyone shed some light on this? There are practically no references to that via Google, it seems to be a Grails 3.x class? Also, I am using Java 1.7.
Class grails.artefact.Service is indeed accessible from v3.0 of grails framework - as can be seen here.
With the following statement grailsVersion = '2.4.4' v2.4.4 is specified to be used and it all looks ok. What spoils the build is the following dependencies entry:
compile 'org.grails.plugins:asset-pipeline:3.0.1'
In this package there is a class asset/pipeline/grails/AssetProcessorService that imports the mentioned grails.artefact.Service which isn't loaded at runtime (probably because of v2.4.4 used).
Unfortunately I can't suggest any solution apart from the trivial like excluding this dependency. I am not a grails developer nor have I set the environment up.
Hopes that helps somehow.

Grails can't load maven-publisher

I am trying to add maven-publisher to a Grails (2.3.6) plugin like so:
dependencies {
compile 'org.mongodb.morphia:morphia:0.107'
compile ":maven-publisher:0.8.1"
}
When I run grails compile I get:
| Error There was an error loading the BuildConfig: Bad artifact coordinates
:maven-publisher:0.8.1, expected format is <groupId>:<artifactId>[:<extension>[
:<classifier>]]:<version> (Use --stacktrace to see the full trace)
What's going on here?
Do not use the maven-publisher plugin. It's old and deprecated. Use the release plugin - it should already be in your plugin's BuildConfig.groovy. If not, here's how it should look (after removing unnecessary cruft):
grails.project.work.dir = 'target'
grails.project.dependency.resolution = {
inherits 'global'
log 'warn'
repositories {
grailsCentral()
mavenLocal()
mavenCentral()
}
dependencies {
compile 'org.mongodb.morphia:morphia:0.107'
}
plugins {
build ':release:3.0.1', ':rest-client-builder:1.0.3', {
export = false
}
}
}
As #dmahapatro said in his comment, jar dependencies go in the dependencies block, and plugin dependencies go in the plugins block.
Note also that you should keep the export = false setting so the plugin is available locally for your use, but doesn't leak into the containing application as an unnecessary transitive dependency.

Grails 2.0 plugin dependencies

I'm trying to build a Grails 2.0 application using private plugins:
mycompany-frontend = Grails Application
mycompany-core = Grails plugins for domain classes
In the mycompany-core plugin, I created some domain classe and added a joda-time dependency in BuildConfig.groovy:
plugins {
build(":tomcat:$grailsVersion",
":release:1.0.1",
":svn:1.0.2") {
export = false
}
build(":joda-time:1.3.1")
}
in the mycompany-frontend app, I have the following BuildConfig.groovy:
plugins {
runtime ":hibernate:$grailsVersion"
runtime ":resources:1.1.5"
build "mycompany:mycompany-core:0.1-SNAPSHOT"
build ":svn:1.0.2"
build ":spring-security-core:1.2.7"
build ":tomcat:$grailsVersion"
}
I also removed grails.plugins entries from application.properties to avoid confusion.
But at the end, the mycompany-frontend cannot find the model classes from mycompany-core plugin.
What should I look/fix to get this working?
Have you tried to define the dependency to your core-plugin as runtime-/compile-dependency instead of build?

Resources