Creating Ldap Plug ii Grails 2.3 - grails

I'm trying to move my project from Grails 2.2.4 to Grails 2.3.5, and I need some plugins, one of them is Ldap's. To access to my repository I have an URL:
grailsRepo "http:// svn................"
and my dependency resolver is maven
an Y have this code after:
plugins {
// plugins for the build system only
build ":tomcat:7.0.50"
// plugins for the compile step
compile ":scaffolding:2.0.1"
compile ':cache:1.1.1'
// plugins needed at runtime but not for compilation
runtime ":hibernate:3.6.10.7"// or ":hibernate4:4.1.11.6" or hibernate:3.6.10.7
runtime ":database-migration:1.3.8"
runtime ":jquery:1.10.2.2"
runtime ":resources:1.2.1"
compile ":ldap:0.8.3.2"
}
and I got the next error
The following artifacts could not be resolved: org.grails.plugins:ldap:zip:0.8.3.2, org.grails.plugins:spring-security-ldap-dcas:zip:1.0.6: Could not find artifact org.grails.plugins:ldap:zip:0.8.3.2 in grailsCentral (http://repo.grails.org/grails/plugins)
|Run 'grails dependency-report' for further information.

It looks like the latest version of the ldap plugin is 0.8.2 - see http://grails.org/plugin/ldap
If this is a custom build that's in your local repo, try switching to the ivy resolver

Related

Grails : How to migrate dependencies upgrading from 2.x.x to 3.0.8?

I am attempting to upgrade an existing Grails application from version 2.4.4 to 3.0.8. I have a couple issues that I am currently unable to resolve.
First issue: The old version's BuildConfig.groovy referenced a jar file that was in the lib directory. I tried copying the same configuration from BuildConfig.groovy to build.gradle and created a lib directory with the jar but Grails is unable to resolve the dependency.
Second issue: The old version had a plugin defined. I tried copying the same plugin definition from BuildConfig.groovy into build.gradle, but this isn't working. I noticed that the plugin isn't currently listed in Bintray, is this the problem?
Below is the dependency section of the build.gradle file.
dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-dependencies"
compile "org.grails:grails-web-boot"
compile "org.grails.plugins:hibernate"
compile "org.grails.plugins:cache"
compile "org.hibernate:hibernate-ehcache"
compile "org.grails.plugins:scaffolding"
compile "com.stripe:stripe-java:1.32.1"
compile "com.google.code.gson:gson:2.3.1"
compile "javax.mail:mail:1.4"
runtime "org.grails.plugins:asset-pipeline"
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
// Note: It is recommended to update to a more robust driver (Chrome, Firefox etc.)
testRuntime 'org.seleniumhq.selenium:selenium-htmlunit-driver:2.44.0'
console "org.grails:grails-console"
//jar file located in lib directory
runtime "com.easypost:easypost-java:2.1.2"
//grails plugin
compile ":shiro:1.2.1"
}
Thanks in advance for any guidance provided.
Issue 1: If that jar is a standard jar and you can reference it from maven then that would be good. But still if you need to include it from some local directory then you can do this:
repositories {
flatDir {
//Directory path containing Jar
dirs 'libs'
}
}
dependencies {
//Jar File Name - No need to add suffix .jar
compile name: 'someJarFile'
}
Issue 2: If the plugin is not listed in bintray then that means it has not been upgraded for Grails 3.x. Either you can upgrade it for yourself or remove the plugin if possible.

Exclude Gradle dependency at debug

I'm using Grails plugin to execute (war and debug) Grails 2.5.0 project.
It seems one of dependencies contain older dependency than I would like to you. When I war a project correct version is used, but at debug it uses older dependenvy version:
dependencies {
bootstrap "org.grails.plugins:tomcat:7.0.50" // No container is deployed by default, so add this
// plugins for the compile step
compile "joda-time:joda-time:2.3"
compile("org.grails.plugins:spring-security-rest:1.5.2") {
exclude module: 'xml-apis'
exclude module: 'joda-time'
}
compile 'org.grails.plugins:cache:1.1.8'
// plugins needed at runtime but not for compilation
runtime ("org.grails.plugins:hibernate4:4.3.8.1") { exclude module: 'xml-apis' } // or ":hibernate:3.6.10.18"
runtime "org.grails.plugins:database-migration:1.4.0"
}
So at debug I have joda-time 1.6 which is shipped with spring-security-rest:1.5.2. But when war-ed joda-time version is 2.3

envers and hibernate plugins incompatibility

I'm using hibernate plugin and trying to integrate envers plugins to my project. But the following issue appears:
when I'm trying to start project it gives me an exception:
[groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
[groovyc] General error during conversion: java.lang.NoClassDefFoundError: org/hibernate/event/PostInsertEventListener
my build config is as follows:
{
plugins {
// plugins for the build system only
build ":tomcat:7.0.54"
// plugins for the compile step
compile ":scaffolding:2.1.2"
compile ':cache:1.1.7'
compile ":asset-pipeline:1.8.11"
compile ":spring-security-ui:1.0-RC2"
// plugins needed at runtime but not for compilation
runtime ":hibernate4:4.3.5.4" // or ":hibernate:3.6.10.16"
runtime ":envers:2.1.0"
runtime ":database-migration:1.4.0"
runtime ":jquery:1.11.1"
}
I tried to find PostInsertEventListener class and I found it but under different package - under org.hibernate.event.spi and for some reason it tries to find it in under org/hibernate/event. Is it some plugins incompatibility issue? Thank you!
run grails dependency-report to see the conflicts
you can also try replacing the hib4 plugin with hib3. this should most probably be causing the compile error

grails upgrade from 2.2.0 to 2.3.4

Hi I upgraded my Grails application from 2.2.0 to Grails 2.3.4, but I'm getting this error :
|Loading Grails 2.3.4
|Configuring classpath
Error |
Resolve error obtaining dependencies: Failed to resolve dependencies (Set log level to 'warn' in BuildConfig.groovy for more information):
- org.apache.tomcat.embed:tomcat-embed-core:7.0.47
- org.apache.tomcat:tomcat-catalina-ant:7.0.47
- org.apache.tomcat.embed:tomcat-embed-jasper:7.0.47
(Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: Failed to resolve dependencies (Set log level to 'warn' in BuildConfig.groovy for more information):
- org.grails:grails-datastore-gorm-hibernate:2.0.6.RELEASE
- junit:junit-dep:4.10
(Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: Failed to resolve dependencies (Set log level to 'warn' in BuildConfig.groovy for more information):
- org.grails:grails-datastore-gorm-hibernate:2.0.6.RELEASE
(Use --stacktrace to see the full trace)
Error |
Failed to resolve dependencies (Set log level to 'warn' in BuildConfig.groovy for more information):
- org.apache.tomcat.embed:tomcat-embed-core:7.0.47
- org.apache.tomcat:tomcat-catalina-ant:7.0.47
- org.apache.tomcat.embed:tomcat-embed-jasper:7.0.47
Any recommendations to fix this issue ?
From the Grails 2.3.4 Release Notes
If you are upgrading from previous versions of Grails 2.3.x and you use the Hibernate and/or Tomcat plugins you will need to update the versions in BuildConfig:
build ':tomcat:7.0.47'
runtime ':hibernate:3.6.10.6'
And since you are upgrading from 2.3, I think you should also read What's new in Grails 2.3?
Grails 2.3.4 requires you to upgrade most of your dependencies. I don't know all but I think you have to upgrade hibernate to hibernate 3. Here's what my current project's BuildConfig looks like:
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
runtime 'mysql:mysql-connector-java:5.1.24'
//compile 'com.paypal.sdk:merchantsdk:2.4.103'
compile 'joda-time:joda-time:2.2'
compile ('org.apache.poi:poi:3.9','org.apache.poi:poi-ooxml:3.9')
compile 'com.stripe:stripe-java:1.3.0'
}
plugins {
// plugins for the build system only
build ":tomcat:7.0.41"
// plugins for the compile step
compile ":scaffolding:2.0.0.RC1"
compile ':cache:1.1.1'
// plugins needed at runtime but not for compilation
runtime ":hibernate:3.6.10.6" // or ":hibernate4:4.1.11.M2"
runtime ":database-migration:1.3.5"
compile ":jquery:1.10.2"
runtime ":resources:1.2"
// Uncomment these (or add new ones) to enable additional resources capabilities
//runtime ":zipped-resources:1.0.1"
//runtime ":cached-resources:1.1"
//runtime ":yui-minify-resources:0.1.5"
//app plugins
compile ':webflow:2.0.8.1'
compile ":mail:1.0.1"
compile ":asynchronous-mail:1.0-RC5" //1.0
compile ":spring-security-core:1.2.7.3"
compile ':excel-export:0.1.10'
compile ":spring-security-core:1.2.7.3"
test ":spock:0.7"
}
This works for me.

Getting Error Fatal error during compilation org.apache.tools.ant.BuildException: Compilation Failed. in grails app

When I run grails run-app through terminal or using Grails/Groovy tool suite, it gets "compilation error" with
`Error Fatal error during compilation org.apache.tools.ant.BuildException: Compilation Failed (Use --stacktrace to see the full tr`ac`e)
.
I am using grails 2.0. Below is what happen when I run grails run-app through ubuntu terminal.
Loading Grails 2.0.0
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application
> You currently already have a version of the plugin installed [hibernate-2.0.0]. Do you want to update to [hibernate-3.6.10.2]? [y,n] n
| Plugin hibernate-3.6.10.2 install aborted
> You currently already have a version of the plugin installed [tomcat-2.0.0]. Do you want to update to [tomcat-7.0.42]? [y,n] n
| Plugin tomcat-7.0.42 install aborted
> You currently already have a version of the plugin installed [release-2.2.1]. Do you want to update to [release-3.0.1]? [y,n] n
| Plugin release-3.0.1 install aborted
| Plugin release-3.0.1 install aborted..
Compiling 4 source files.
| Error Fatal error during compilation org.apache.tools.ant.BuildException: Compilation Failed (Use --stacktrace to see the full trace
)
BuildConfig.groovy
grails.servlet.version = "2.5" // Change depending on target container compliance (2.5 or 3.0)
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.target.level = 1.6
grails.project.source.level = 1.6
//grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// uncomment to disable ehcache
// excludes 'ehcache'
}
log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
grailsCentral()
mavenCentral()
// uncomment these to enable remote dependency resolution from public Maven repositories
//mavenCentral()
//mavenLocal()
//mavenRepo "http://snapshots.repository.codehaus.org"
//mavenRepo "http://repository.codehaus.org"
//mavenRepo "http://download.java.net/maven/2/"
//mavenRepo "http://repository.jboss.com/maven2/"
}
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
runtime 'mysql:mysql-connector-java:5.1.16'
}
plugins {
build ':release:2.2.1', ':rest-client-builder:1.0.3', {
export = false
}
runtime ":hibernate:$grailsVersion"
runtime ":jquery:1.7.1"
runtime ":spring-security-core:1.2.7.2"
runtime ':resources:1.2'
runtime ":cached-resources:1.0"
runtime ":zipped-resources:1.0"
compile ":cache-headers:1.1.5"
build ":tomcat:2.0.0"
//compile ":attachmentable:0.3.0"
compile ":searchable:0.6.4"
compile ":cloud-bees:0.6.2"
compile ":jquery-validation:latest.release"
compile ":jquery-validation-ui:latest.release"
compile ":twitter-bootstrap:2.3.2"
compile ":lesscss-resources:1.3.3"
runtime ":fields:1.3"
compile ":mail:1.0.1"
compile ":jquery-ui:1.8.24"
compile ":spring-security-ui:0.2"
compile ":mail:1.0"
compile ":famfamfam:1.0"
compile ":spring-security-acl:1.1.1"
}
}
When I run grails run-app, It always ask for updating tomcat and hibernate plugings to latest version. I dont know why this is happening. Any suggestion on this.
Can It related to tomcat and hibernate plugin versons?
application.properties
#Grails Metadata file
#Thu Nov 14 15:09:35 IST 2013
app.grails.version=2.0.0
app.name=VProcureFinal
app.servlet.version=2.5
app.version=0.1
plugins.avatar=0.6.3
plugins.burning-image=0.5.1
plugins.class-diagram=0.5.2
plugins.jquery-validation-ui=1.4.4
plugins.prototype=1.0
plugins.richui=0.8
plugins.webxml=1.4.1
*grails run-app out*put:
grails run-app
| Packaging Grails application
> You currently already have a version of the plugin installed [tomcat-2.0.0]. Do you want to update to [tomcat-7.0.42]? [y,n] n
| Installed plugin release-3.0.1
| Error Plugin release-3.0.1 requires version [2.3 > *] of Grails which your current Grails installation does not meet. Please try install a different version of the plugin or Grails.
| Installed plugin release-3.0.1
.
A couple of suggestions. The most likely answer is applications.properties specifying something different to BuildConfig.groovy.
You are running 2.0.0. How about at least trying 2.0.4 as there would be bug fixes?
BuildConfig.groovy doesn't look like the authoritative source. e.g. tomcat is specified as 2.0.0 specifically so you don't have the typical upgrade problem, where in 2.3.x these plugins moved from $grailsVersion.
Check application.properties. The grails version in there will be 2.0.0 - can see this from the startup. The tomcat and hibernate versions may be specified here as the versions you see in the startup.
grails clean and/or delete .grails directory in your home directory.

Resources