Grails の application.groovy をコンパイル/実行するために使用されるクラスパスは何ですか?
私の application.groovy で、カスタム クラス (依存関係の jar に含まれる) をインスタンス化し、次のように構成プロパティの 1 つに割り当てます。
environments {
production {
configProperty = new com.example.CustomClass()
最近、アプリケーションを Grails 3.1.5 から 3.2.2 にアップグレードしましたが、これが機能しなくなりました。
を実行しようとすると、次のようなエラーが表示されますgrails run-app
。
Error occurred running Grails CLI: startup failed:
script14788250424471597489853.groovy: 43: unable to resolve class com.example.CustomClass
@ line 43, column 33.
configProperty = new com.example.CustomClass()
(コードはproduction
ブロック内にありますが、開発中 ( run-app
) で実行していることに注意してください。これにより、このスクリプトのコンパイルが失敗していると思われます。)
したがって、依存関係(を含む)を適切なクラスパスに追加するだけでよいと思いますが、CustomClass
どれがどれかわかりません。
私はgradleを使用しており、build.gradleファイルに次のものを含めて、以下を含む依存関係を取り込みますCustomClass
:
buildscript {
dependencies {
classpath "com.example:custom-module:1.1"
// ...
dependencies {
compile group: 'com.example', name: 'custom-module', version:'1.1'
}