配置
按照 Grails 3.2.11 手册中的插件和多项目构建部分,假设我可以在终端中使用以下命令设置多项目:
echo "Creating the root folder..."
mkdir test-multi-project
cd test-multi-project
echo "Creating the settings.gradle file..."
echo "include 'myapp', 'myplugin'" >> settings.gradle
echo "Creating the Grails application..."
grails create-app myapp
echo "Creating the Grails plugin..."
grails create-plugin myplugin
echo "Configuring the dependency between the application and the plugin..."
echo "grails { plugins { compile project(':myplugin') } }" >> myapp/build.gradle
echo "Executing the Grails application..."
cd myapp
grails run-app
错误
但是,当我尝试使用这些命令来创建和配置 Grails 应用程序和插件时,该grails run-app
命令会引发下一个错误:
FAILURE: Build failed with an exception.
* Where:
Build file '~/test-multi-project/myapp/build.gradle' line: 61
* What went wrong:
A problem occurred evaluating root project 'myapp'.
> Project with path ':myplugin' could not be found in root project 'myapp'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
CONFIGURE FAILED
Total time: 4.835 secs
| Error Error initializing classpath: Project with path ':myplugin' could not be found in root project 'myapp'. (Use --stacktrace to see the full trace)
附加信息
我已经使用 Grails 3.2.8、3.2.9、3.2.10 和 3.2.11 测试了上述命令,并且代码抛出了相同的错误。
另一方面,我使用 Grails 3.2.3、3.2.5 和 3.2.7 测试了上述命令,项目执行良好。此外,Grails 登录页面显示应用程序正在使用“mypluin”。
注意,我使用 sdk 来处理 Grails 版本。这些命令是使用 Java 1.7 和 Yosemite 执行的:
- 时髦的:2.4.7
- Ant:2015 年 6 月 29 日编译的 Apache Ant(TM) 版本 1.9.6
- JVM:1.7.0_141(Azul Systems, Inc. 24.141-b11)
- 操作系统:Mac OS X 10.10.5 x86_64
问题:
我想知道我还需要做什么或者我做错了什么才能使此代码在 Grails 3.2.11 上运行
提前致谢。