Search code examples
grailspluginsmulti-projectgrails3grails-3.2

Plugins in a Multiproject fails at Grails 3.2.11


Configuration

Following the Plugins and Multi-Project Builds section at the Grails 3.2.11 manual, its suppose that I can setup a Multi-project with the next commands in a terminal:

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 

Error

However, when I tried those commands for create and configure the Grails Application and the Plugin the grails run-app command throws next error:

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)

Additional Information

I already tested the above commands using Grails 3.2.8, 3.2.9, 3.2.10 and 3.2.11 and the code throws the same error.

On the other hand, I tested the above commands using Grails 3.2.3, 3.2.5, and 3.2.7 and the project is executed fine. Also, the Grails landing page shows that 'mypluin' is been used by the application.

Note, I am using sdk to handle the Grails versions. The commands were executed using Java 1.7 and Yosemite:

  • Groovy: 2.4.7
  • Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
  • JVM: 1.7.0_141 (Azul Systems, Inc. 24.141-b11)
  • OS: Mac OS X 10.10.5 x86_64

Question:

I am wondering what else I need to do or what I am doing wrong in order to make this code works on Grails 3.2.11

Thanks in advance.


Solution

  • Jeff Brown fixed the above issue removing the multi-project-test2/myapp/settings.gradle file and adding the next line to the multi-project-test2/settings.gradle file:

    project(':myapp').name = 'myapp'

    As you can see at the next GitHub's commit: https://github.com/esalomon/multi-project-test2/commit/d92c3fbc67156bcd1af9f47dc6f2984534154bad

    After the above updated the multi-project-test2 can be downloaded and it will work fine.