We are currently using grails 2.2 and are trying to upgrade to 2.4, but we have an issue.
In BuildConfig.groovy, we have a few dependencies and plugins that use latest.release.
For example: 'com.example:myplugin:latest.release'.
In grails 2.2, this would work as expected. In grails 2.4, I receive an error: Error Resolve error obtaining dependencies: Could not find artifact ...
We are using the latest version of Artifactory. The error indicates that grails is looking in the correct location, but cannot find it.
If we specify a specific version then grails finds it ok. For example: 'com.example:myplugin:12.03.01'
Has something changed with latest.release since version 2.2? Should we now specify the version numbers?
Thanks.
The latest.release syntax is Ivy specific and only worked with the Ivy resolver. Grails 2.4 uses Aether a dependency resolver which is the dependency resolution engine found in the Maven build tool. In Maven the syntax for expression the latest version is slightly different. See http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution#DependencyMediationandConflictResolution-DependencyVersionRanges
So to get the latest version you expression a minimum version with no upper bound. Example:
compile ":feeds:[1.6,)"
Related
I am trying to upgrade my grails application from 2.0.0 to 2.5.5, running into Unresolved dependencies for groovy-all jar.
Dependency resolver in BuildConfig.groovy is set to ivy. Also, location %USERPROFILE%/.grails/ivy-cache/org.codehaus.groovy contains groovy-all.jar of version 2.4.5
Java is set to JDK7
Exact error:
org.codehaus.groovy#groovy-all;2.4.5: configuration not found in org.codehaus.groovy#groovy-all;2.4.5: 'master'. It was required from org.grails#grails-core;2.5.5 compile
BuildConfig.groovy
grails.project.dependency.resolver = "ivy"
repositories {
mavenRepo "link to company specific repo"
mavenCentral()
}
plugins {
runtime ":hibernate4:4.3.10"
runtime ":jquery:1.7.1"
runtime ":resources:1.1.5"
runtime ":bubbling:1.5.1"
runtime ":calendar:1.2.1"
runtime ":code-coverage:1.1.6"
runtime ":jsecurity:0.3"
runtime ":tomcat:7.0.42"
runtime ":webflow:1.3.7"
runtime ":webtest:1.1.5.1"
runtime ":yui:2.8.2.1"
build ":tomcat:7.0.70"
}
Please help. Let me know if any additional details needed.
After spending lot of time finding reason for this issue, I came across an issue reported in Grails version 2.5.5 (https://github.com/grails/grails-core/issues/10011) So before going to my project, tried to execute basic grails command "grails-createapp". This command also failed with error mentioned in question above.
Solution in our case was to
1. Remove Grails version 2.5.5 (if this is already installed)
2. Download/install Grails version 2.5.4
3. Run basic command grails-createapp. This runs fine and an app is created.
4. Remove Grails version 2.5.4
5. Install Grails version 2.5.5 now
6. Run command - grails createapp (this starts working now)
Strange issue :)
For upgrade to version 2.5.5 add to your BuildConfig dependencies the line
compile 'org.codehaus.groovy:groovy-all:2.4.6'
This worked for me.
I need to setup a Windows working environment for Grails. I'd like to use GGTS as an IDE but got several errors compiling a sample project. Currently I'm using jdk1.8.0_40 and Grails 2.5.0. which results in this error (but in the end the project is working):
Groovy:Unexpected problem with AST transform: The Spock compiler
plugin cannot execute because Spock 1.0.0-groovy-2.4 is not compatible
with Groovy 2.3.10. For more information, see http://versioninfo.spockframework.org
On top of that there are two Java Exception Breakpoints which are listed as "unknown". Only info regarding version support I could find is:
Java SDK 1.5+ for Grails 1.2 or greater
GGTS itself seems not to run with the latest grails (3.0.1) since I simply cannot add it (directory appears not to be a grails installation).
Should I use Java 7 instead?
This issue is not related to JDK 1.8 or 1.7, but its is related to the GGTS IDE 3.6.4 Groovy Compiler version. As the error clarifies that Spock 1.0.0 version needs Groovy 2.4 compiler.
GGTS 3.6.4.RELEASE-e4.4.2 IDE comes with Groovy 2.3.10 compiler by Default.
Install Groovy Compiler 2.4 Feature and "switch to 2.4" will resolve this issue.
Refer: http://docs.codehaus.org/display/GROOVY/Compiler+Switching+within+Groovy-Eclipse
If you cannot switch compilers from the IDE Groovy Compiler preference page, follow the instructions to perform the switch from outside of Eclipse:
(Grails 2.5.0 uses Spock 1.0.0 (and internally Groovy 2.4.3 and this is why your project is compiling & working fine as the Grails runtime environment is taking over)
As an additional experience report to the answer above, thus providing another solution variant: I had to use the http://dist.springsource.org/snapshot/GRECLIPSE/e4.4 update site (as opposed to the release version mentioned in the link above) to make the 2.4 compiler feature available in the update manager.
After installation, the compiler errors are gone.
I noticed that project-specific groovy compiler is set in the Groovy Compiler preference page in new grails projects. By selecting "I don't care" for "Groovy compiler" it will default to the workspace groovy compiler which is usually correct (for me it's version 2.4). This worked for me but experience may vary.
I'm going to migrate an existing Grails 2.0 plugin to 2.4.
According to the migration guide the following steps were done:
run set-grails-version 2.4.4
update to latest plugin versions (hibernate4, tomcat, release and etc)
In in Intellij I've changed plugin SDK version on 2.4.4. Now module->dependencies looks like
It looks good but when I do grails compile, I have MultipleCompilationErrorsException in SvnDeployer class of release:3.0.1 plugin with "unable to resolve" message: unable to resolve class org.apache.commons.io.FilenameUtils(it's strange, commons.io is included into grails library)
On SDK of 2.0 everything is fine, but when I change SDK version to 2.4, project can not be compiled.
From my experience, Grails upgrades are not really smooth especially between feature releases.
I recommend starting with the usual
grails clean
grails refresh-dependencies
grails compile
After that check if you still get the same kind of errors, see whether or not excluding the svn plugin helps (if you're not using it).
I am working in grails 2.4.0 and installed excel-import 1.0.0 plugin to the project. While compiling the project it is generating an error that could not resolve the class Application Holder. Please help.
I was having the same problem. You can get the version 1.0.1 of the plugin here https://github.com/jbarmash/grails-excel-import
Or if you prefer, add this url to the repositories section in BuildConfig.groovy
mavenRepo "http://maven.ala.org.au/repository/"
I found that this repository has the latest version of the plugin (at least it compiles with grails 2.4.4, real tests are yet to be made)
Then add this two entries to the plugins section
compile ":excel-import:1.0.1"
compile ":joda-time:1.5"
Upgrade your plugin to the latest 1.0.1 version. It was made 2.4.x compatible.
Iām trying to upgrade Grails to version 2.2.0. I used gvm and installed Grails 2.2.0. After this I changed my project in GGTS to use Grails version 2.2.0 and Groovy version 2.0.0. But when I finally tried to run the project, I got the following error:
Error occurred during initialization of VMError opening zip file or JAR manifest
missing : null
agent library failed to init: instrument
What is the problem?
We had the same problem.
This is due to eclipse saving old run configuration for the previous grails version.
Just remove old launch configuration and retry.
To remove old launch configuration :
go to Run\RunConfiguration\Grails
select all nodes and remove them.
I had the same problem when I started using Grails 2.2.0 - The solution Ian mentioned works, here is the link to the issue and resolution that occurred in my project
Grails 2.2.0 error
Added on 1/15/2013 Other suggestions based on 2.2.0/ivy cache issues
I am running on windows, a couple of things to try.
Based on your error message seems like the issue might be related to the Ivy cached, I would suggest cleaning that out using the clean command.
I would also go ahead and delete the Icy cache folders on your machine at \ivy-cache(after backing it up just in case)
Read grails documentation at http://grails.org/doc/2.0.0/guide/gettingStarted.html, refer to section 2.3 regarding Ivy cache ā there might be issues running 2.x and 1.x grails projects side by side.
When install, I do not have to install groovy explicitly - I just install grails and that take care of the groovy code implicitly. Is that possible for you to do? To rule out dependency issues?
On my version of grails I have the groovy version showing up as 2.0.5 ā I assume you meant grails 2.2.0 ā can you ensure that you have a groovy version installed with is compatible with grails 2.2.0?
If possible try your code on a fresh device where grails has not been installed before. This is to rule out interference due to other existing issues
It's a known issue to do with the fact that the version of the springloaded reloading agent used by 2.2 (and 2.1.3) has a different name from that used by previous versions of Grails. There's a workaround in the bug report, or you can upgrade to a nightly build of GGTS which knows about the new name (as described in this bug report).
I am using GGTS 3.2 with Groovy compiler 2.1.1 on Windows XP.
Had imported a project from GGTS 3.1, upgraded compiler to 2.1.1 and got in mess, so
deleted the project and removed it from .grails cache, then re-created project from scratch. When it came to running the project I got the ivy error.
Removing the old launch configuration via Run->RunConfiguration...Grails fixed problem without switching to a night build of GGTS.
(BTW Deleting ivy-cache didn't help at all)