I need to call a plugin with arguments from a grails event script. How do I do this?
Specifically, I’m trying to hook into eventCompile to call generate-dto --all, sending y to STDIN.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The easiest (and probably slowest) way to do it is to invoke grails in an event handler. This is a bit tricky, since
generate-dtogenerates a compile event, but you can make it conditional on a system property. A second problem is the required input. By convention, grails scripts are all supposed to accept--non-interactiveand not prompt the user, but the dto plugin seems to not follow this. A workaround for Posix systems like Linux or MacOS X is to pipe in theyescommand as the grails input.Here’s how I got it working: