0

Followed the tutorial on multi-projects

Everything mostly works. Plugin controllers & domain classes load properly in the application. However, a problem occurs when trying to run a Plugin's custom script from the application's grails CLI.

For example:

If you set up the multi-project directory structure like this:

  • Project Root
    • Application Directory
    • Plugin Directory
    • settings.gradle

And ran this command from the Plugin Directory

grails create-script hello

You'd be able to access the script when running grails from the Plugin Directory, but not the Application's Directory.

Is there a way to get this to work properly? Do I need to use an alternative set up?

Also see Creating a Custom Script in Grails

HumbleWebDev
  • 555
  • 4
  • 20
  • After reading more I've come to realize that a multi-project's plugin is different than a conventional grails 3 pluign. For this reason, you want to manually package these plugins. – HumbleWebDev Jul 09 '18 at 15:23

1 Answers1

0

A conventional grails 3 plugin is different than a plugin within a multi-project. It doesn't seem to be designed to compile a plugin such as grails scaffolding with custom commands.

For this reason, you should package the plugin manually using:

grails package-plugin
grails install

Now in the build.gradle, add this line to dependencies:

compile "<plugin-group>:<plugin-name>:<plugin-version>

Subsituting the appropriate information within the brackets <>.

  • You can find the plugin-group in the plugin's build.gradle
    • group "org.grails.plugins"
  • plugin-name you specified in the grails create-plugin command
    • grails create-plugin plugin-name
  • plugin-version is also found in the plugin's build.gradle
    • version "0.1"
HumbleWebDev
  • 555
  • 4
  • 20