Grails 2.3 - 新示例项目无效

时间:2013-06-04 11:24:19

标签: grails grails-plugin grails-2.0

我创建了一个新的grails 2.3示例项目。

刷新依赖项或run-app

时出错
Loading Grails 2.3.0.M1
| Configuring classpath
| Error org.sonatype.aether.collection.DependencyCollectionException: Failed to collect dependencies for [xalan:serializer:jar:2.7.1 (compile), org.grails:grails-bootstrap:jar:2.3.0.M1 (compile), org.grails:grails-scripts:jar:2.3.0.M1 (compile), org.grails.plugins:tomcat:zip:7.0.39 (compile)]
| Error     at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:258)
| Error     at org.sonatype.aether.impl.internal.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:308)
| Error     at org.codehaus.groovy.grails.resolve.maven.aether.AetherDependencyManager.collectDependencies(AetherDependencyManager.groovy:389)
| Error     at org.codehaus.groovy.grails.resolve.maven.aether.AetherDependencyManager.resolve(AetherDependencyManager.groovy:262)
| Error     at grails.util.BuildSettings.doResolve(BuildSettings.groovy:505)
| Error     at grails.util.BuildSettings.doResolve(BuildSettings.groovy)
| Error     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
| Error     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error     at java.lang.reflect.Method.invoke(Method.java:601)
| Error     at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
| Error     at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
| Error     at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1085)
| Error     at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
| Error     at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
| Error     at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1030)
| Error     at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
| Error     at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
| Error     at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
| Error     at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
| Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
| Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:145)
| Error     at grails.util.BuildSettings$_getDefaultBuildDependencies_closure16.doCall(BuildSettings.groovy:756)
| Error     at grails.util.BuildSettings$_getDefaultBuildDependencies_closure16.doCall(BuildSettings.groovy)
| Error     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
| Error     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error     at java.lang.reflect.Method.invoke(Method.java:601)
| Error     at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:272)
| Error     at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:64)
| Error     at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
| Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
| Error     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
| Error     at grails.util.BuildSettings.getDefaultBuildDependencies(BuildSettings.groovy:750)
| Error     at grails.util.BuildSettings.getBuildDependencies(BuildSettings.groovy:655)
| Error     at org.codehaus.groovy.grails.cli.support.ClasspathConfigurer.getClassLoaderUrls(ClasspathConfigurer.java:107)
| Error     at org.codehaus.groovy.grails.cli.support.ClasspathConfigurer.configuredClassLoader(ClasspathConfigurer.java:70)
| Error     at org.codehaus.groovy.grails.cli.GrailsScriptRunner.initializeState(GrailsScriptRunner.java:618)
| Error     at org.codehaus.groovy.grails.cli.GrailsScriptRunner.initializeState(GrailsScriptRunner.java:601)
| Error     at org.grails.ide.api.impl.GrailsConnectorImpl.ensureInitialized(GrailsConnectorImpl.java:127)
| Error     at org.grails.ide.api.impl.GrailsConnectorImpl.executeCommand(GrailsConnectorImpl.java:141)
| Error     at org.grails.ide.eclipse.longrunning.process.GrailsProcess.run(GrailsProcess.java:126)
| Error     at org.grails.ide.eclipse.longrunning.process.GrailsProcess.main(GrailsProcess.java:89)
| Error     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| Error     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
| Error     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
| Error     at java.lang.reflect.Method.invoke(Method.java:601)
| Error     at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:235)
| Error     at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:263)
| Error Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for xalan:serializer:jar:2.7.1
| Error     at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:296)
| Error     at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
| Error     at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:412)
| Error     at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240)
| Error     ... 48 more
| Error Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not transfer artifact xalan:serializer:pom:2.7.1 from/to grailsCentral (http://repo.grails.org/grails/plugins): null to http://repo.grails.org/grails/plugins/xalan/serializer/2.7.1/serializer-2.7.1.pom
| Error     at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
| Error     at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
| Error     at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
| Error     at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:281)
| Error     ... 51 more
| Error Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not transfer artifact xalan:serializer:pom:2.7.1 from/to grailsCentral (http://repo.grails.org/grails/plugins): null to http://repo.grails.org/grails/plugins/xalan/serializer/2.7.1/serializer-2.7.1.pom
| Error     at org.sonatype.aether.connector.async.AsyncRepositoryConnector$3.wrap(AsyncRepositoryConnector.java:1546)
| Error     at org.sonatype.aether.connector.async.AsyncRepositoryConnector$3.wrap(AsyncRepositoryConnector.java:1537)
| Error     at org.sonatype.aether.connector.async.AsyncRepositoryConnector$GetTask.flush(AsyncRepositoryConnector.java:1035)
| Error     at org.sonatype.aether.connector.async.AsyncRepositoryConnector.get(AsyncRepositoryConnector.java:409)
| Error     at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:457)
| Error     ... 54 more
| Error Caused by: java.net.ConnectException: null to http://repo.grails.org/grails/plugins/xalan/serializer/2.7.1/serializer-2.7.1.pom
| Error     at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:95)
| Error     at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:381)
| Error     at org.jboss.netty.channel.DefaultChannelFuture.addListener(DefaultChannelFuture.java:148)
| Error     at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.doConnect(NettyAsyncHttpProvider.java:945)
| Error     at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.execute(NettyAsyncHttpProvider.java:776)
| Error     at com.ning.http.client.AsyncHttpClient.executeRequest(AsyncHttpClient.java:484)
| Error     at org.sonatype.aether.connector.async.AsyncRepositoryConnector$GetTask.run(AsyncRepositoryConnector.java:891)
| Error     at org.sonatype.aether.connector.async.AsyncRepositoryConnector.get(AsyncRepositoryConnector.java:402)
| Error     ... 55 more
| Error Caused by: java.nio.channels.UnresolvedAddressException
| Error     at sun.nio.ch.Net.checkAddress(Net.java:85)
| Error     at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:597)
| Error     at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.connect(NioClientSocketPipelineSink.java:140)

| org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.eventSunk出错(NioClientSocketPipelineSink.java:103) | org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream出错(OneToOneEncoder.java:60) | org.jboss.netty.handler.codec.http.HttpClientCodec.handleDownstream出错(HttpClientCodec.java:82) | org.jboss.netty.handler.stream.ChunkedWriteHandler.handleDownstream出错(ChunkedWriteHandler.java:115) | org.jboss.netty.channel.Channels.connect出错(Channels.java:541) | org.jboss.netty.channel.AbstractChannel.connect出错(AbstractChannel.java:210) | org.jboss.netty.bootstrap.ClientBootstrap.connect出错(ClientBootstrap.java:227) | org.jboss.netty.bootstrap.ClientBootstrap.connect出错(ClientBootstrap.java:188) | com.ning.http.client.providers.netty.NettyAsyncHttpProvider.doConnect(NettyAsyncHttpProvider.java:902)出错 |错误... 59更多

我的BuildConfig.groovy是这样的:

    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.work.dir = "target/work" grails.project.target.level =
     1.6 grails.project.source.level = 1.6 //grails.project.war.file = "target/${appName}-${appVersion}.war"

     forkConfig = [maxMemory: 1024, minMemory: 64, debug: false, maxPerm:
     256] grails.project.fork = [    test: forkConfig, // configure
     settings for the test-app JVM    run: forkConfig, // configure
     settings for the run-app JVM    war: forkConfig, // configure settings
     for the run-war JVM    console: forkConfig // configure settings for
     the Swing console JVM ]

     grails.project.dependency.resolver = "maven" // or ivy
     grails.project.dependency.resolution = {
     

System.setProperty(“http.proxyHost”,“10.20.30.40”);     System.setProperty(“http.proxyPort”,“80”);

// 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
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()
    mavenLocal()
    grailsCentral()
    mavenCentral()
    // uncomment these (or add new ones) 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 {
    // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
    // runtime 'mysql:mysql-connector-java:5.1.24'
}

plugins {
    // plugins for the build system only
    build ":tomcat:7.0.39"

    // plugins for the compile step
    compile ":scaffolding:1.0.0"
    compile ':cache:1.0.1'

    // plugins needed at runtime but not for compilation
    runtime ":hibernate:3.6.10.M3" // or ":hibernate4:4.1.11.BUILD-SNAPSHOT"
    runtime ":database-migration:1.3.3"
    runtime ":jquery:1.9.1"
    runtime ":resources:1.2"
    // Uncomment these (or add new ones) to enable additional resources capabilities
    //runtime ":zipped-resources:1.0.1"
    //runtime ":cached-resources:1.1"
    //runtime ":yui-minify-resources:0.1.5"
} }

4 个答案:

答案 0 :(得分:5)

user2264997一样,您可以使用add-proxyset-proxy为Grails 2.3配置全局代理。

http://grails.org/doc/latest/ref/Command%20Line/add-proxy.html

grails add-proxy client --host=proxy-server --port=4300 --username=guest --password=guest

运行该命令时,grails将创建包含代理信息的${HOME}/.grails/ProxySettings.groovy。您可以根据心脏的内容调整设置。

需要注意的一点是,您不应该从项目目录运行grails add-proxy,因为它会在尝试设置代理之前尝试解决缺少的依赖项。我只是备份了一个目录来运行它。

答案 1 :(得分:4)

直到他们弄清楚maven的错误

在BuildConfig中将grails.project.dependency.resolver =“maven”更改为grails.project.dependency.resolver =“ivy”

不要忘记刷新依赖项

答案 2 :(得分:0)

我只是通过删除我现有的Maven缓存目录($ HOME / .m2)来解决同样的问题。我还没有深入研究为什么这解决了这个问题。

答案 3 :(得分:-1)

将Jars添加到App中的Lib文件夹;

您可以从http://central.maven.org/maven2/org/apache/tomcat/tomcat-catalina-ant/7.0.42下载Jars。