I have a project, that consists of two modules - core and web. Core module contains some domain classes and services, while web module has controllers and other front end staff. If I put controller into the core module I can do grails run-app and then access my service directly via REST plugin in Chrome browser. But when controllers are in web module I cannot resolve dependency between these modules. In the BuildConfig.groovy for the web module I have
plugins {
// plugins for the build system only
build ":tomcat:7.0.53"
compile ":myapp-core:0.1-SNAPSHOT"
// plugins for the compile step
compile ":scaffolding:2.1.0"
compile ':cache:1.1.6'
compile ":asset-pipeline:1.9.6"
compile ":angular-annotate-asset-pipeline:1.1.2"
}
BuildConfig for the core looks like:
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.fork = [
// configure settings for compilation JVM, note that if you alter the Groovy version forked compilation is required
// compile: [maxMemory: 256, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
// configure settings for the test-app JVM, uses the daemon by default
test: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
// configure settings for the run-app JVM
run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
// configure settings for the run-war JVM
war: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
// configure settings for the Console UI JVM
console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
]
grails.project.dependency.resolver = "maven" // or ivy
grails.project.dependency.resolution = {
//legacyResolve true
// 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 {
grailsCentral()
mavenLocal()
mavenCentral()
// uncomment the below to enable remote dependency resolution
// from public Maven repositories
//mavenRepo "http://repository.codehaus.org"
//mavenRepo "http://download.java.net/maven/2/"
//mavenRepo "http://repository.jboss.com/maven2/"
}
dependencies {
compile 'com.hazelcast:hazelcast:3.3.2'
}
plugins {
// plugins for the build system only
build ":tomcat:7.0.52.1"
//plugin for consuming REST web services
compile ":rest-client-builder:1.0.3"
//plugin for consuming REST web services
build(":release:3.0.1") {
export = false
}
}
}
When I am running build for the web module I am always getting following errors:
|Loading Grails 2.4.3 |Configuring classpath Error | Resolve error obtaining dependencies: Could not find artifact org.grails.plugins:myapp-core:zip:0.1-SNAPSHOT in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace) Error | Resolve error obtaining dependencies: Could not find artifact org.grails.plugins:myapp-core:zip:0.1-SNAPSHOT in grailsCentral (hyperlink to repo.grails.org removed) (Use --stacktrace to see the full trace) Error | Resolve error obtaining dependencies: Could not find artifact org.grails.plugins:myapp-core:zip:0.1-SNAPSHOT in grailsCentral (hyperlink to repo.grails.org removed) (Use --stacktrace to see the full trace) Error | Could not find artifact org.grails.plugins:myapp-core:zip:0.1-SNAPSHOT in grailsCentral (hyperlink to repo.grails.org removed) |Run 'grails dependency-report' for further information.
And myapp-core.zip file really does not exist in the .m2 repository. Although it does create proper directory chain there but it contains only resolver-status.properties file. I went through the Grails documentation and Manning book but still cannot find the resolution. In plain old Java with maven it is a piece of cake, but in Grails, despite all the claims of how easy and straightforward it is, I beating my head against this wall for a week.
Help me, please-please-please.