min*_*ime 2 java grails groovy gradle
配置:
MacOS 文图拉,13.5
JDK:Liberica JDK 11 和/或 Liberica JDK 17
系统 Gradle:Gradle 8.2.1
Grails:Grails 版本:6.0.0
问题:
我可以跑
$> grails create-app foobar
Run Code Online (Sandbox Code Playgroud)
创建一个新的空 Grails 应用程序。那部分工作正常。
然后我可以 cd 进入“foobar”目录并运行
$> ./gradlew clean build
Run Code Online (Sandbox Code Playgroud)
我在使用上述 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()'
Run Code Online (Sandbox Code Playgroud)
如果我尝试使用系统 Gradle 进行构建:
$> gradle clean build
Run Code Online (Sandbox Code Playgroud)
我得到了这个(再次使用 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 :
Run Code Online (Sandbox Code Playgroud)
如果我尝试使用 JDK 17,使用 Gradle 包装器,我会得到几乎相同的错误:
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.
Run Code Online (Sandbox Code Playgroud)
对于 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 :
Run Code Online (Sandbox Code Playgroud)
另外,仅供参考,由 grails create-app 命令创建的 Gradle 包装器适用于版本 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
Run Code Online (Sandbox Code Playgroud)
所以基本上我被困住了。我无法使用生成的包装器或最新 Gradle 的系统安装,使用 JDK 11(根据文档记录为 Grails 6 的最低要求)或 JDK 17 来构建生成的 Grails 项目。如果有人对如何解决这个问题并构建这个 Grails 应用程序有任何想法,我将非常感谢您的见解。
尝试了您提供的相同命令,但我没有得到您所看到的问题。话虽如此,最近遇到了类似的问题:Unable to runintegrationtestswhenupgradegrails从版本5到6-无法确定任务':integrationTest'的依赖关系
而且似乎也与 gradle 版本有关。确保您的“buildSrc”文件夹具有 gradle 版本 7.6.2。
还要确保 gradle/wrapper/gradle-wrapper.properties 文件具有此行
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
Run Code Online (Sandbox Code Playgroud)
对我来说,从新的 grails 6 应用程序中再次替换“buildSrc”文件夹是有效的。
| 归档时间: |
|
| 查看次数: |
468 次 |
| 最近记录: |