加载BuildConfig时出错(Grails 2.1.0)



为了弄清楚这个问题,我已经绞尽脑汁好几个小时了。每当我试图对我新创建的Grails项目执行任何类型的操作(使用新的Grails安装)时,我都会收到以下错误消息:

Error There was an error loading the BuildConfig: ivy pattern must be absolute: 
${HOME}/.m2/alpha/repository/[organisation]/[module]/[revision]/[module]-[revision](-
[classifier]).pom (Use --stacktrace to see the full trace)

我可以推断我的安装有问题,但正如我所说,这是一个新的安装,所以我不确定是什么原因导致了这个问题。

我正在运行Win7。任何帮助都将不胜感激。

编辑:

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") {
        // specify dependency exclusions here; for example, uncomment this 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()
        mavenLocal()
        mavenCentral()
        // uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
        //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.20'
    }
    plugins {
        runtime ":hibernate:$grailsVersion"
        runtime ":jquery:1.7.1"
        runtime ":resources:1.1.6"
        // Uncomment these (or add new ones) to enable additional resources capabilities
        //runtime ":zipped-resources:1.0"
        //runtime ":cached-resources:1.0"
        //runtime ":yui-minify-resources:0.1.4"
        build ":tomcat:$grailsVersion"
        runtime ":database-migration:1.1"
        compile ':cache:1.0.0.RC1'
    }
}

问题目前已解决。

这是一个Maven问题,我一开始没有考虑。出于某种原因,/Users/USERNAME/.mp2/settings.xml中的localRepository标记无法解析HOME的路径,因此用C:\Users/USERNAME替换${HOME}就成功了。很奇怪,但它目前有效。如果有人有更好的解决方案,请告诉我!

我的解决方案有点不同:

(1) 创建一个指向.m2存储库位置的变量:

def localMavenRepo = "file://" + new File(System.getProperty('user.home'), '.m2/repository').absolutePath

(2) 创建存储库条目:

repositories { 
    ... 
    mavenRepo name: 'Local', root: localMavenRepo 
}

我也遇到了同样的问题。我认为这不是Maven的问题,而是Apache Ivy的问题。

我认为ApacheMaven2/3运行良好,只是ApacheIvy没有选择正确的Maven文件夹。ApacheIvy没有按应有的方式扩展${user.home}。

我通过将M2_REPO环境变量设置为绝对路径来解决此问题。在linux上:

export M2_HOME=/home/chris/.m2/repository/

在窗口中,您可以在"系统属性"对话框中设置环境变量("系统属性的快捷方式是WindowsKey+PauseKey)。转到系统属性->高级->环境变量

最新更新