Disclaimer and warning: this post may become outdated at any time, but currently the most up-to-date information from Ellucian is:
- Eclipse 4.6 (Neon) is the most current Eclipse IDE supported for developing Admin Pages. You must use an Eclipse-based IDE for developing Admin Pages, because the required plugins for development are only available for Eclipse. The plugins have been tested with Eclipse 4.4 (Mars), 4.5 (Luna), and (4.6) Neon.
- IntelliJ Idea Ultimate is the recommended IDE for developing Self-Service extensions. The current IntelliJ version 2017.2.3 still supports the Groovy and Grails versions being shipped with Banner.
- Other IDEs with Groovy and Grails support may be used for Self-Service development. Support for extending Banner and using Grails will be provided, but do not count on any support for using the IDE with Groovy and Grails.
- Banner 9 ships with Grails 2.5, which depends on and includes Groovy 2.4.
Background
A few years back both Groovy and Grails were projects supported by Pivotal, the company that brings Spring to the Java EE table. Grails is a web application framework built on top of the Spring framework, and Groovy is a dynamic language that Grails depends on to speed up application development. Pivotal's flagship IDE Spring Tool Suite (STS) is based on Eclipse, and Pivotal provided Eclipse plugins for both Groovy and Grails. They also offered a version of STS with Groovy and Grails plugins pre-installed, called GGTS. The Groovy plugin added syntactical support for the language in the editor, and the Grails plugin provided support creating Grails components and running Grails applications from the toolbar and menus. In January 2015 Pivotal decided to drop their sponsorship of Groovy and Grails, and that pretty much ended support for the plugins as well.
So, the Pivotal Groovy and Grails plugins stopped at Eclipse 4.3 (Kepler), although with some significant juggling of the Java libraries installed, you may be able to install them in 4.4 (Mars). That is as far as I will take the Pivotal plugins.
Eclipse
Fortunately, the Groovy team has continued to provide Eclipse plugins for the language, right up through Eclipse 4.7 (Oxygen). Without that, there would not be any hope for using Grails, because editing Groovy code would be impossible.
Unfortunately, without the Pivotal plugin there is no menu or toolbar support for Grails commands in newer versions of Eclipse. So, there are two choices: use Grails commands on the command line, or use a Gradle script to provide tasks that may be executed from within Eclipse. In any case, Groovy support must be added first.
Adding Groovy support
To use Grails, you need Groovy support in the editor. The Groovy project has a list of the installation repositories for different Eclipse plugin versions at https://github.com/groovy/groovy-eclipse/wiki. If you are using the latest that Ellucian supports, Eclipse 4.6 Neon, the link that you need to configure Eclipse: http://dist.springsource.org/snapshot/GRECLIPSE/e4.6/.
In the Eclipse Help menu select Install New Software..., and in the Work with text box paste the link and press Enter/Return. Pick the Groovy-Eclipse feature, that should install the Groovy Compiler 2.4 feature as well. Click the next button, accept any license agreements, and complete the installation:
Using Grails command-line support
The simple solution is to learn the command-line operations for Grails and run them in a terminal window. Eclipse has a tabbed terminal window that may be used for this.
Before launching Eclipse, make sure that the Grails bin folder is included in your environment PATH variable. Microsoft Windows installations work immediately, but if you are using Apple MacOS or Linux, the shell in the terminal will not read ~/.bash_profile. To fix this in Eclipse go to Eclipse Preferences -> Terminal -> Local Terminal and add --login to the arguments field. --login causes bash to think it is a login shell and read the ~/.bash_profile.
Once Eclipse is started, make a new Groovy project. This project will have the Groovy nature, and Eclipse will recognize the Groovy files. The template for a Groovy project is in the Other list under Groovy and is titled Groovy Project. I called the project for this example school.
Eclipse has a built-in terminal window so we do not need to switch back and forth between two tools. If the Terminal view does not appear under the menu Window -> Show View, the select Other... and look for it underneath the Terminal category:
The Terminal view normally docks to the bottom window pane of Eclipse. It works best there because it has a wide area to show the output. If it did not dock there, to move it just click and drag the Terminal tab to move it.
The terminal button is used to open terminal tabs; open two local terminal tabs. One will be for executing Grails commands to build things like controllers; the other will be to run the Tomcat server with grails run-app. The terminal windows are normally opened in your home directory. In the first terminal tab change directory to the new project folder. Run the command grails create-app --inplace <project_name> to build the new Grails project. The --inplace flag builds the project in the current folder, instead of creating a new folder.
Change the action in the controller to render 'Hello World!' In the second terminal tab change to the project directory and execute grails run-app and test the application. Change the message in the controller and watch the application rebuild in the second terminal window.
Gradle support
Gradle is a build tool, and there are several Eclipse plugins that provide Gradle support. Eclipse Buildship is the plugin provided by Eclipse.org. You cannot add Grails commands to the Eclipse menu or toolbar, but Gradle does provide an advantage over the command line with a view that shows all of the defined Gradle tasks and allows them to be executed. The tasks that require input will be configured to provide a dialog to get it:
First add the Eclipse Buildship plugin to the IDE. Do this using the Eclipse Marketplace under the Help menu. This will require a restart of Eclipse.
Build an empty Groovy project with the name of the Grails application.
Add a build.gradle file to the project. This example is a basic version, but it does have the code to read input using a dialog and the basic tasks. It is a good starting point if you need to expand on the selection of Grails tasks:
// build.gradle // // Gradle build file that defines commonly used tasks for Grails projects. See below to set correct paths for the GRAILS and JAVA_HOME // variables before continuing. // // Set these paths correctly before using: // def GRAILS = '/opt/local/grails-2.5.0/bin/grails' def JAVA_HOME = '/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home' import groovy.swing.SwingBuilder // This defines the task group name in the task view. // def GRAILS_TASKS = 'Grails Tasks' // Support methods. // def getValue(def title, def prompt) { def value = '' new SwingBuilder().edt { dialog(modal: true, title: title, alwaysOnTop: true, resizable: false, locationRelativeTo: null, pack: true, show: true) { vbox { // Put everything below each other label text: prompt def input1 = textField() button defaultButton: true, text: 'OK', actionPerformed: { value = input1.text; dispose(); } } } } value } // These are the tasks. // task createApp() { group = GRAILS_TASKS doLast { exec { def appName = getValue('Create-App', 'Application Name') environment 'JAVA_HOME', JAVA_HOME commandLine GRAILS, 'create-app', '--inplace', appName } } } task createController { group = GRAILS_TASKS doLast { exec { def controllerName = getValue('Create-Controller', 'Fully qualified controller name') environment 'JAVA_HOME', JAVA_HOME commandLine GRAILS, 'create-controller', controllerName } } } task createDomainClass() { group = GRAILS_TASKS doLast { exec { def domainClassName = getValue('Create-Domain-Class', 'Fully qualified domain class name') environment 'JAVA_HOME', JAVA_HOME commandLine GRAILS, 'create-domain-class', domainClassName } } } task createPlugin() { group = GRAILS_TASKS doLast { exec { def pluginName = getValue('Create-Plugin', 'Plugin module name') environment 'JAVA_HOME', JAVA_HOME commandLine GRAILS, 'create-plugin', '--inplace', pluginName } } } task createService() { group = GRAILS_TASKS doLast { exec { def serviceName = getValue('Create-Service', 'Fully qualified service name') environment 'JAVA_HOME', JAVA_HOME commandLine GRAILS, 'create-service', serviceName } } } task runApp(type:Exec) { group = GRAILS_TASKS doLast { exec { environment 'JAVA_HOME', JAVA_HOME commandLine GRAILS, 'run-app' } } } task runWar() { group = GRAILS_TASKS doLast { exec { environment 'JAVA_HOME', JAVA_HOME commandLine GRAILS, 'run-war' } } } task stopApp() { group = GRAILS_TASKS doLast { exec { environment 'JAVA_HOME', JAVA_HOME commandLine GRAILS, 'stop-app' } } } task testApp() { group = GRAILS_TASKS doLast { exec { environment 'JAVA_HOME', JAVA_HOME commandLine GRAILS, 'test-app' } } } task version() { group = GRAILS_TASKS doLast { exec { environment 'JAVA_HOME', JAVA_HOME commandLine GRAILS, '-version' } } } task war() { group = GRAILS_TASKS doLast { exec { environment 'JAVA_HOME', JAVA_HOME commandLine GRAILS, 'war' } } }
Add the Gradle nature to the project by right-clicking on the project for the context menu, choosing Configure, and selecting Add Gradle Nature.
The Gradle task view may be opened from Window -> Show View (look under Other... for Gradle). With this view open, double click on any task to run it. The first job is to create the application using the Gradle/Grails createApp task, providing the same name as the project folder. The output of the Grails command will be in the console view.
Use the createController task to create a new controller class. Refresh the project to make sure the new file shows up, and then change the index action to render 'Hello World!'
Use the Gradle/Grails runApp task to run the Tomcat server, build the Grails applications, and serve it. Browse to http://localhost:8080/<application name> in a Web browser to see the application.
With the application running change the text rendered by the controller to 'Hello World from Grails!' Verify that the file was recompiled and reloaded.
The Tomcat server may be stopped by executing the Gradle/Grails task stopApp.
Conclusion
If you are comfortable using Eclipse and want to use it for both Admin Pages and Self-Service extension development, there really is not any reason that should stop you from doing that.
The only real advantage that IntelliJ Idea adds is menu and toolbar support for Grails commands. It is not difficult to just use the commands from the command line, and the Gradle script provided above comes pretty close to having menu commands if that is what you really want.
No comments:
Post a Comment