groovy 无法使用提供的Gradle Package 器或系统Gradle构建新创建的Grails 6.0.0应用程序

qeeaahzv  于 2023-10-15  发布在  其他
关注(0)|答案(1)|浏览(161)

配置

MacOS Ventura,13.5
JDK:Liberica JDK 11和/或Liberica JDK 17
系统Gradle:Gradle 8.2.1
Grails:Grails版本:6.0.0

问题

我能跑

$> grails create-app foobar

创建一个新的、空的Grails应用程序。这部分工作正常。
然后,我可以cd到'foobar'目录并运行

$> ./gradlew clean build

在使用上面提到的JDK 11时,我遇到了以下错误:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':integrationTest'.
> Could not create task ':mergeTestReports'.
   > 'org.gradle.api.file.DirectoryProperty org.gradle.api.tasks.testing.TestReport.getDestinationDirectory()'

如果我尝试用Gradle系统构建:

$> gradle clean build

我得到了这个(再次使用JDK 11):

> Configure project :
Cannot resolve reloading agent JAR: Failed to resolve imported Maven boms: Cannot resolve external dependency org.springframework.boot:spring-boot-dependencies:2.7.12 because no repositories are defined.
Required by:
    project :

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file '/Users/prhodes1/development/experimental/grails/foobar/build.gradle' line: 22

* What went wrong:
A problem occurred evaluating root project 'foobar'.
> Failed to apply plugin 'org.grails.grails-gsp'.
   > Could not create task ':compileGroovyPages'.
      > Could not create task of type 'GroovyPageForkCompileTask'.
         > java.lang.InstantiationException (no error message)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring root project 'foobar'.
> Could not resolve all files for configuration ':runtimeClasspath'.
   > Cannot resolve external dependency io.micronaut:micronaut-inject-groovy:3.9.3 because no repositories are defined.
     Required by:
         project :

如果我尝试使用JDK 17,使用Gradle Package 器,我会得到几乎相同的错误:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':integrationTest'.
> Could not create task ':mergeTestReports'.
   > 'org.gradle.api.file.DirectoryProperty org.gradle.api.tasks.testing.TestReport.getDestinationDirectory()'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

对于JDK 17和系统Gradle的组合也是如此:

> Configure project :
Cannot resolve reloading agent JAR: Failed to resolve imported Maven boms: Cannot resolve external dependency org.springframework.boot:spring-boot-dependencies:2.7.12 because no repositories are defined.
Required by:
    project :

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file '/Users/prhodes1/development/experimental/grails/foobar/build.gradle' line: 22

* What went wrong:
A problem occurred evaluating root project 'foobar'.
> Failed to apply plugin 'org.grails.grails-gsp'.
   > Could not create task ':compileGroovyPages'.
      > Could not create task of type 'GroovyPageForkCompileTask'.
         > java.lang.InstantiationException (no error message)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring root project 'foobar'.
> Could not resolve all files for configuration ':runtimeClasspath'.
   > Cannot resolve external dependency io.micronaut:micronaut-inject-groovy:3.9.3 because no repositories are defined.
     Required by:
         project :

此外,仅供参考,grailscreate-app命令创建的Gradle Package 器适用于版本7.2

C02FK2T0ML85:foobar prhodes1$ ./gradlew --version

------------------------------------------------------------
Gradle 7.2
------------------------------------------------------------

Build time:   2021-08-17 09:59:03 UTC
Revision:     a773786b58bb28710e3dc96c4d1a7063628952ad

Kotlin:       1.5.21
Groovy:       3.0.8
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          17.0.6 (BellSoft 17.0.6+10-LTS)
OS:           Mac OS X 13.5 x86_64

所以基本上我被困住了。我无法让生成的Grails项目使用JDK 11(根据文档,这是Grails 6的最低要求)或JDK 17构建,使用生成的 Package 器或最近的Gradle的系统安装。如果有人对如何解决这个问题并构建Grails应用程序有任何想法,我将非常感谢您的见解。

utugiqy6

utugiqy61#

已尝试使用您提供的相同命令,但我没有得到您看到的问题。说到这里,刚刚遇到了类似的问题:Unable to run integration tests when upgrading grails from version 5 to 6 - Could not determine the dependencies of task ':integrationTest'
而且看起来它也与Gradle版本有关。确保你的“buildSrc”文件夹有gradle版本7.6.2。
还要确保gradle/wrapper/gradle-wrapper.properties文件中有这一行

distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip

对我来说,从新鲜的grails 6应用程序中再次替换“buildSrc”文件夹工作了。

相关问题