【问题标题】:Cannot resolve dependency to the homegrown module无法解析对本地模块的依赖
【发布时间】:2014-11-16 23:41:50
【问题描述】:

我有一个项目,它包含两个模块 - 核心和网络。 核心模块包含一些领域类和服务,而网络模块有控制器和其他前端人员。 如果我将控制器放入核心模块,我可以执行 grails run-app,然后通过 Chrome 浏览器中的 REST 插件直接访问我的服务。 但是当控制器在 web 模块中时,我无法解决这些模块之间的依赖关系。 在 BuildConfig.groovy 中我拥有的网络模块

    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 如下所示:

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
    }
  }

}

当我为 web 模块运行构建时,我总是遇到以下错误:

|加载 Grails 2.4.3 |配置类路径 错误 | 解决获取依赖项的错误:在 grailsCentral (http://repo.grails.org/grails/plugins) 中找不到工件 org.grails.plugins:myapp-core:zip:0.1-SNAPSHOT(使用 --stacktrace 查看完整跟踪) 错误 | 解决获取依赖项的错误:在 grailsCentral 中找不到工件 org.grails.plugins:myapp-core:zip:0.1-SNAPSHOT(删除了指向 repo.grails.org 的超链接)(使用 --stacktrace 查看完整跟踪) 错误 | 解决获取依赖项的错误:在 grailsCentral 中找不到工件 org.grails.plugins:myapp-core:zip:0.1-SNAPSHOT(删除了指向 repo.grails.org 的超链接)(使用 --stacktrace 查看完整跟踪) 错误 | 在 grailsCentral 中找不到工件 org.grails.plugins:myapp-core:zip:0.1-SNAPSHOT(已删除指向 repo.grails.org 的超链接) |运行“grails dependency-report”以获取更多信息。

而且 myapp-core.zip 文件确实不存在于 .m2 存储库中。 虽然它确实在那里创建了正确的目录链,但它只包含 resolver-status.properties 文件。 我浏览了 Grails 文档和 Manning 书,但仍然找不到解决方案。 在带有 maven 的普通 Java 中,这是小菜一碟,但在 Grails 中,尽管有人声称它是多么简单和直接,我还是用头撞墙了一个星期。

请帮帮我,请-请-请。

【问题讨论】:

    标签: java grails plugins dependencies


    【解决方案1】:

    您可以使用grails.plugin.location 提到的in the docs 或者您可以运行maven-install 在本地安装它。

    【讨论】:

      猜你喜欢
      • 2017-10-19
      • 2018-04-25
      • 2022-01-02
      • 2020-11-15
      • 2012-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多