Grails dependency error-only looks in grailsCentral not other repos - grails

Grails 2.5...
I have a plugin in an SVN repository.
Here is the build config (minus authentication credentials)....
grails.project.dependency.resolver = "maven" // maven or ivy
grails.project.dependency.resolution = {
inherits("global") {
// specify dependency exclusions here; for example, uncomment this to disable ehcache:
// excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
grailsCentral()
mavenLocal()
mavenCentral()
mavenRepo "http://repo.grails.org/grails/plugins"
mavenRepo name:"*********", root: "*********************"
}
plugins {
runtime ':org-calendar-viewer:0.7.9'
}
But I always get a dependency resolve error it could not find the plugin at grailsCentral. Of course it couldn't the plugin is in a different repo. Is grailsCentral the last place it looks? Or the first place it looks?
Resolve error obtaining dependencies: Could not find artifact in grailsCentral (https://repo.grails.org/grails/plugins)
I tried commenting out the grails repos and then it fails as
Resolve error obtaining dependencies: Could not find artifact in mavenCentral (https://repo1.maven.org/maven2/)
So it seems it is throwing an error after only checking one(first) location?

Related

Grails plugin dependency pulled into maven cache, but main project can't resolve classes

Using Grails 2.5.4
I have a plugin that uses the Twilio SDK (7+).
The plugin packages without error.
When I run the main project it throws an error saying that the it
cannot resolve the import com.twilio.Twilio class in the plugin
controllers/services.
I confirm that the Twilio SDK has been pulled into the local Maven
cache when the plugin was pulled in, so it knows to get the dependency.
The main project BuildConfig includes mavenLocal() in the dependency
resolution.
Where do I look next to find the cause of this dependency resolution problem?
plugin dependencies.groovy
grails.project.dependency.resolver = "maven"
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
repositories {
grailsCentral()
// uncomment the below to enable remote dependency resolution
// from public Maven repositories
mavenLocal()
mavenCentral()
}
dependencies {
compile 'com.twilio.sdk:twilio:7.8.0'
}
in plugin.xml
<dependencies>
<compile>
<dependency group='com.twilio.sdk' name='twilio' version='7.8.0' />
</compile>
</dependencies>
In main project BuildConfig.gorrcy
plugins{
compile ":twilio-ext:1.0"
}
running grails dependency-report I see
org.grails.plugins:twilio-ext:1.0
But it has no sub dependencies listed.

Geb driver issue after upgrading to Grails 2.4.5

Upon upgrading my Grails version from 2.3.6 to 2.4.5, I am now getting an exception when running Geb Spock tests.
failed to create driver from callback 'script14328041759692122350870$_run_closure1#5fcdf5ea'
geb.driver.DriverCreationException: failed to create driver from callback 'script14328041759692122350870$_run_closure1#5fcdf5ea'
at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:35)
at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy:85)
at geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:32)
at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:84)
at geb.Configuration.createDriver(Configuration.groovy:361)
at geb.Configuration.getDriver(Configuration.groovy:350)
at geb.Browser.getDriver(Browser.groovy:105)
at geb.Browser.clearCookies(Browser.groovy:496)
at geb.spock.GebSpec.methodMissing(GebSpec.groovy:54)
at AuthorizationAdminSpec.setupSpec(AuthorizationAdminSpec.groovy:21)
Caused by: java.lang.NoClassDefFoundError: org/apache/http/conn/SchemePortResolver
at org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.getDefaultHttpClientFactory(ApacheHttpClient.java:234)
at org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.<init>(ApacheHttpClient.java:211)
at org.openqa.selenium.remote.HttpCommandExecutor.getDefaultClientFactory(HttpCommandExecutor.java:88)
at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:62)
at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:57)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:93)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:191)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:99)
at script14328041759692122350870.run_closure1(script14328041759692122350870.groovy:12)
at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:29)
... 9 more
Caused by: java.lang.ClassNotFoundException: org.apache.http.conn.SchemePortResolver
at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:175)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:147)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 23 more
I remember encountering this exception before during my initial Geb setup in Grails 2.3.6, in which the BuildConfig and GebConfig files were not properly configured. However, upon re-checking the necessary plugins and dependencies required of Geb, I did not notice anything different for Grails 2.4.5 Also, I switched my dependency resolution from Ivy to Maven, so I double checked my maven resources to make sure the driver was loaded.
Some more info...
BuildConfig.groovy
grails.project.dependency.resolver = "maven"
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// specify dependency exclusions here; for example, uncomment this to disable ehcache:
// excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
repositories {
grailsPlugins()
grailsHome()
grailsCentral()
mavenLocal()
mavenCentral()
mavenRepo "http://repository.jboss.com/maven2/"
mavenRepo "http://google-api-client-libraries.appspot.com/mavenrepo"
mavenRepo "http://mvnrepository.com/artifact/"
mavenRepo "http://repo.jenkins-ci.org/repo"
mavenRepo "http://repo.grails.org/grails/repo"
}
dependencies {
....
compile "org.springframework:spring-test:4.0.9.RELEASE"
test "org.gebish:geb-spock:0.10.0"
test "org.seleniumhq.selenium:selenium-support:2.45.0"
test "org.seleniumhq.selenium:selenium-firefox-driver:2.45.0"
}
plugins {
....
test ":geb:0.10.0"
}
GebConfig.groovy
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.firefox.FirefoxProfile
reportsDir = "target/geb-reports"
baseUrl = "http://localhost:8090/adverity/"
driver = {
//set the firefox locale to 'en-us' since the tests expect english
//see http://stackoverflow.com/questions/9822717 for more details
FirefoxProfile profile = new FirefoxProfile()
profile.setPreference("intl.accept_languages", "en-us")
def driverInstance = new FirefoxDriver(profile)
driverInstance.manage().window().maximize()
driverInstance
}
baseNavigatorWaiting = true
atCheckWaiting = true
autoClearCookies = false
quitCachedDriverOnShutdown = false
Any simple spec that I run will throw the same error.I tried doing the same with Chrome to test if this is a driver issue and got the same results. Both firefox and Chrome drivers work with Grails 2.3.6, but not 2.4.5.
OS: Fedora 20
Browser: Firefox 38
Places I have looked already...
Book of Geb
GebGrails git hub example
StackOverflow
test 'org.apache.httpcomponents:httpclient:4.3.2'
Added to the dependencies section in BuildConfig.groovy
I was not aware of this dependency as I did not see it in any documentation, but a deeper look inside the stack trace told me otherwise.

Configure Artifactory with grails project

I am trying to configure a Grails project with remote Artifactory but failing to configure it properly.
Envionmanet setup
grails-2.4.3
artifactory.version 3.3.0
BuildConfig.groovy
grails.project.dependency.resolver = "maven" // or ivy
grails.project.ivy.authentication = {
repositories {
mavenRepo "http://SERVER/artifactory/grails-remote"
}
credentials {
realm = "Artifactory Realm"
host = "SERVER"
username = "USERNAME"
password = "PASSWORD"
}
}
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// specify dependency exclusions here; for example, uncomment this to disable ehcache:
// excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
repositories {
inherits true // Whether to inherit repository definitions from plugins
mavenRepo id: 'Artifactory', url: "http://SERVER/artifactory/grails-remote"
}
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
// runtime 'mysql:mysql-connector-java:5.1.29'
// runtime 'org.postgresql:postgresql:9.3-1101-jdbc41'
test "org.grails:grails-datastore-test-support:1.0-grails-2.4"
}
plugins {
// plugins for the build system only
build ":tomcat:7.0.55"
// plugins for the compile step
compile ":scaffolding:2.1.2"
compile ':cache:1.1.7'
compile ":asset-pipeline:1.9.6"
compile ":rabbitmq:1.0.0"
// plugins needed at runtime but not for compilation
runtime ":hibernate4:4.3.5.5" // or ":hibernate:3.6.10.17"
runtime ":database-migration:1.4.0"
runtime ":jquery:1.11.1"
}
}
Getting the below exception after executing the refresh-dependencies command for the project
Loading Grails 2.4.3
|Configuring classpath
Error |
Resolve error obtaining dependencies: The following artifacts could not be resolved: org.grails.plugins:scaffolding:zip:2.1.2, org.grails.plugins:cache:zip:1.1.7, org.grails.plugins:webxml:zip:1.4.1, org.grails.plugins:asset-pipeline:zip:1.9.6, org.grails.plugins:rabbitmq:zip:1.0.0, org.grails.plugins:hibernate4:zip:4.3.5.5, org.grails.plugins:database-migration:zip:1.4.0, org.grails.plugins:jquery:zip:1.11.1: Could not find artifact org.grails.plugins:scaffolding:zip:2.1.2 in Artifactory (http://SERVER/artifactory/grails-remote) (Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: The following artifacts could not be resolved: org.grails.plugins:scaffolding:zip:2.1.2, org.grails.plugins:cache:zip:1.1.7, org.grails.plugins:webxml:zip:1.4.1, org.grails.plugins:asset-pipeline:zip:1.9.6, org.grails.plugins:rabbitmq:zip:1.0.0, org.grails.plugins:hibernate4:zip:4.3.5.5, org.grails.plugins:database-migration:zip:1.4.0, org.grails.plugins:jquery:zip:1.11.1: Could not find artifact org.grails.plugins:scaffolding:zip:2.1.2 in Artifactory (http://SERVER/artifactory/grails-remote) (Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: The following artifacts could not be resolved: org.grails.plugins:scaffolding:zip:2.1.2, org.grails.plugins:cache:zip:1.1.7, org.grails.plugins:webxml:zip:1.4.1, org.grails.plugins:asset-pipeline:zip:1.9.6, org.grails.plugins:rabbitmq:zip:1.0.0: Could not find artifact org.grails.plugins:scaffolding:zip:2.1.2 in Artifactory (http://SERVER/artifactory/grails-remote) (Use --stacktrace to see the full trace)
Error |
The following artifacts could not be resolved: org.grails.plugins:scaffolding:zip:2.1.2, org.grails.plugins:cache:zip:1.1.7, org.grails.plugins:webxml:zip:1.4.1, org.grails.plugins:asset-pipeline:zip:1.9.6, org.grails.plugins:rabbitmq:zip:1.0.0: Could not find artifact org.grails.plugins:scaffolding:zip:2.1.2 in Artifactory (http://SERVER/artifactory/grails-remote)
|Run 'grails dependency-report' for further information.
Process was killed
I have read and tried couple of solutions as described in below link but it couldn't help
How to configure grails 2.4.0 to resolve artifacts from artifactory with authentication?
http://wordpress.transentia.com.au/wordpress/2014/04/09/artifactory-and-grails/
Update1:
After looking closely into Artifactory's apache catalina log I found that for some of plugins it is causing some forbidden error.
2014-10-15 15:16:19,596 [ajp-bio-8019-exec-10] [INFO ] (o.a.r.s.RepositoryBrowsingServiceImpl:236) - Error while listing remote resources for codehaus/org/grails/grails-datastore-gorm-mongo: Unable to retrieve http://repository.codehaus.org/org/grails/grails-datastore-gorm-mongo/: 403: Forbidden
Can anyone please help me to find out whats wrong with configuration?
Greetings,
Mayank
Rather than defining the repository authentication with grails.project.ivy.authentication, You should probably define the repository with:
grails.project.dependency.resolution = {
repositories {
grailsCentral()
....
mavenRepo(name: 'name', url: 'https://host/artifactory/reponame') {
auth(username: 'username', password: 'password')
}
....
}
}

grails 1.3.9 dependency issue: loading mail-1.4.3.jar as a plugin?

trying to get the code for a legacy system compiling (grails 1.3.9) and I've hit a barrier when it tried to install the mail-1.0.1 plugin. Seems that this succeeds but then then proceeds to try to install the mail-1.4.3.jar as a plugin and fails roling back mail 1.0.1. I've done the google thing and there is only a single reference (bug report) which has been of no help
Could the repositories be causing it?
Here is the specific build error
------------------------------------------
grails create-constraint
[delete] Deleting directory /home/blake/.grails/1.3.9/projects/egrants-grails-1.3.9/resources
Installing zip /home/blake/.ivy2/cache/org.grails.plugins/mail/zips/mail-1.0.1.zip... ...
[mkdir] Created dir: /home/blake/.grails/1.3.9/projects/egrants-grails-1.3.9/plugins/mail-1.0.1
[unzip] Expanding: /home/blake/.ivy2/cache/org.grails.plugins/mail/zips/mail-1.0.1.zip into /home/blake/.grails/1.3.9/projects/egrants-grails-1.3.9/plugins/mail-1.0.1
Installed plugin mail-1.0.1 to location /home/blake/.grails/1.3.9/projects/egrants-grails-1.3.9/plugins/mail-1.0.1. ...
Resolving plugin JAR dependencies ...
Plugin mail-1.0.1 installed
Plugin /home/blake/.ivy2/cache/javax.mail/mail/jars/mail-1.4.3.jar is not a valid Grails plugin. No plugin.xml descriptor found!
[delete] Deleting directory /home/blake/.grails/1.3.9/projects/egrants-grails-1.3.9/plugins/constraints-0.6.0
[delete] Deleting directory /home/blake/.grails/1.3.9/projects/egrants-grails-1.3.9/plugins/mail-1.0.1
application.properties
#Grails Metadata file
#Tue May 27 22:06:43 EST 2014
app.grails.version=1.3.9
app.name=XXXX
app.servlet.version=2.4
app.version=1.XXXXX
plugins.codenarc=0.8.1
plugins.constraints=0.6.0
plugins.cxf=0.7.0
plugins.external-config-reload=1.2-SNAPSHOT
plugins.geb=0.4
plugins.gsp-arse=1.3
plugins.hibernate=1.3.9
plugins.jquery=1.8.3
plugins.jquery-ui=1.8.24
plugins.mail=1.0.1
plugins.nerderg-form-tags=1.3
plugins.rendering=0.4.3
plugins.spock=0.5-groovy-1.7
plugins.spring-security-core=1.0.1
plugins.tomcat=1.3.9
and the BuildConfig
// BuildCOnfig.groovy
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// uncomment to disable ehcache
// excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
repositories {
grailsPlugins()
grailsHome()
grailsCentral()
// uncomment the below to enable remote dependency resolution
// from public Maven repositories
//mavenLocal()
mavenCentral()
//mavenRepo "http://snapshots.repository.codehaus.org"
//mavenRepo "http://repository.codehaus.org"
//mavenRepo "http://download.java.net/maven/2/"
//mavenRepo "http://repository.jboss.com/maven2/"
mavenRepo "http://repo.grails.org/grails/repo/"
mavenRepo "http://repository.springsource.com/maven/bundles/release"
mavenRepo "http://repository.springsource.com/maven/bundles/external"
}
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
// runtime 'mysql:mysql-connector-java:5.1.5'
runtime (group:'com.googlecode.ehcache-spring-annotations', name:'ehcache-spring-annotations', version:'1.2.0') {
excludes(
[name: 'ehcache-core'],
[group: 'org.springframework'],
[group: 'org.slf4j']
)
}
}
}
Turns out that letting it automatically resolve dependencies at compile time is a bad idea (TM). Manually installing every required plugin individually seems to have done the trick:
grails install-plugin <plugin> <version>

getting error when installing new-doc plugin in grails

I am getting failed download error when trying to install new-doc plugin. The error message I get looks like:
==== http://repo.grails.org/grails/libs-releases-local: tried
http://repo.grails.org/grails/libs-releases-local/net/sf/json-lib/json
-lib/2.4/json-lib-2.4.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: FAILED DOWNLOADS ::
:: ^ see resolution messages for details ^ ::
::::::::::::::::::::::::::::::::::::::::::::::
:: net.sf.json-lib#json-lib;2.4!json-lib.jar
::::::::::::::::::::::::::::::::::::::::::::::
| Error Failed to resolve dependencies (Set log level to 'warn' in BuildConfig.groovy for more information):
- net.sf.json-lib:json-lib:2.4
My BuildConfig.groovy looks like:
grails.servlet.version = "3.0" // 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.plugins.dir = "plugins"
grails.project.war.file = "target/${appName}.war"
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// uncomment to disable ehcache
// excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
repositories {
grailsPlugins()
grailsHome()
grailsCentral()
// uncomment the below to enable remote dependency resolution
// from public Maven repositories
//mavenLocal()
mavenCentral()
//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.
compile 'org.apache.poi:poi:3.9'
compile 'org.apache.poi:poi-ooxml:3.9'
compile 'com.google.guava:guava:12.0'
}
plugins {
compile ":new-doc:0.3.2"
}
}
I am fairly new to groovy/grails so I am not sure what should I do next to resolve this issue. Or can anyone suggest me any other code documentation plugin for grails?
Thanks,
Dee
NOTE
When I ran "grails doc" it generated all the documentation code in target/docs folder. It has index.html page which I thought would list all the api functions, but it didn't have any information on the api documents there - so I wrongly concluded that grails doc was not generating the API documentation. I should have looked into target/docs/gapi folder instead to get the generated API documents for grails. I apologize for my noob problem, and not being able to see the solution that was right there in front of me. Thanks.

Resources