First off, thanks for taking the time to contribute! ❤️
Grails is an open source project with an active community and we rely heavily on that community to help make Grails better. As such, there are various ways in which people can contribute to Grails. One of these is by writing useful plugins and making them publicly available.
All types of contributions are encouraged and valued. See the Table of Contents for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉
And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about:
- Star the project
- Tweet about it
- Refer to this project in your project's readme
- Mention the project at local meetups and tell your friends/colleagues
- Donate to the Friends of Grails initiative so others can work on the project.
- I Have a Question
- I Want to Write a Grails Plugin
- I Want To Contribute
- Suggesting Enhancements
- Your First Code Contribution
- Improving The Documentation
- Code Style
- Commit Messages
- Join The Project Team
If you want to ask a question, we assume that you have read the available Documentation.
Before you ask a question, it is best to search for existing Issues that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first.
If you then still feel the need to ask a question and need clarification, we recommend the following:
- Ask a question on Stack Overflow.
- Chat with us on Slack.
- If your question is due to a bug, open an Issue.
- Provide as much context as you can about what you're running into.
- Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant.
Grails Plugins are similar to a Grails Application project, but they include a plugin descriptor and package shared functionality for other Grails Applications to use. More information can be found here.
When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license. All committers must sign the project's CLA. More detailed requirements are available in the project's CLA.
A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible.
- Make sure that you are using the latest version.
- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the documentation. If you are looking for support, you might want to check this section).
- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the bug tracker.
- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue.
- Collect information about the bug:
- Stack trace (Traceback)
- OS, Platform and Version (Windows, Linux, macOS, x86, ARM)
- Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant.
- Possibly your input and the output
- Can you reliably reproduce the issue? And can you also reproduce it with older versions? Sample projects always are the best at investigating bugs.
You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead, sensitive bugs must be sent by email to [email protected].
Grails uses GitHub to track issues in the core framework. Similarly, for its documentation there is a separate tracker. If you run into an issue with the project:
- Open an Issue.
- Explain the behavior you would expect and the actual behavior.
- Please provide as much context as possible and describe the reproduction steps that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case.
- Provide the information you collected in the previous section.
Once it's filed:
- The project team will label the issue accordingly.
- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as
info: need review
. Bugs with theinfo: need review
tag will not be addressed until they are reproduced. - If the team is able to reproduce the issue, it will be marked
status: acknowledged
, as well as possibly other tags (such astype: critical
), and the issue will be left to be implemented by someone.
This section guides you through submitting an enhancement suggestion for Grails, including completely new features and minor improvements to existing functionality. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions.
- Make sure that you are using the latest version.
- Read the documentation carefully and find out if the functionality is already covered, maybe by an individual configuration.
- Perform a search to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library.
Enhancement suggestions are tracked as GitHub issues.
- Use a clear and descriptive title for the issue to identify the suggestion.
- Provide a step-by-step description of the suggested enhancement in as many details as possible.
- Describe the current behavior and explain which behavior you expected to see instead and why. At this point you can also tell which alternatives do not work for you.
- Explain why this enhancement would be useful to most Grails users. You may also want to point out the other projects that solved it better and which could serve as inspiration.
One of the benefits of GitHub is the way that you can easily contribute to a project by forking the repository and sending pull requests with your changes. Please see GitHub's guides on how to create a fork and submit that fork. For easier illustration, the remainder of this document will use the grails
repositories, but when working locally you should use your own fork.
If you're interested in contributing fixes and features to any part of grails, you will have to learn how to get hold of the project's source, build it and test it with your own applications. Before you start, make sure you have:
- A git client
- An Editor such as IntelliJ.
Once you have the pre-requisite packages installed, the next step is to download the Grails source code, which is hosted at GitHub in several repositories owned by the "grails" GitHub user. This is a simple case of cloning the repository you're interested in. For example, to get the core framework run:
git clone http://github.com/grails/grails-core.git
This will create a grails-core
directory in your current working directory containing all the project source files. The next step is setting up the JDK to use. Grails makes use of SDKMAN! for easy JDK setup. Each Grails project should have a .sdkmanrc
in it's root directory. Change to the grails-core
directory and install the preferred JDK by issuing the command:
sdk env .
If you look at the project structure, you'll see that it does not look like a standard GRAILS_HOME
installation. But, it's very simple to turn it into one. Just run this from the root directory of the project:
./gradlew install
This will fetch all the standard dependencies required by Grails and then build a GRAILS_HOME
installation. Note that this target skips the extensive collection of Grails test classes, which can take some time to complete.
Once the above command has finished, simply set the GRAILS_HOME
environment variable to the checkout directory and add the "bin" directory to your path. When you next type grails
command to run, you'll be using the version you just built.
If you are using http://sdkman.io[SDKMAN] then that can also be used to work with this local installation via the following:
sdk install grails dev /path/to/grails-core
You will also need to publish your local installation to your local maven.
./gradlew publishToMavenLocal
Now you will have a dev version in your local which you can use to test your features.
Grails has both local test coverage in the form of unit
and integration
tests and an entire functional test suite located at grails-functional-tests.
To run the full suite of tests in grails-core
execute:
./gradlew test
These will take a while (15-30 mins), so consider running individual tests using the command line. For example, to run the test spec BinaryPluginSpec
simply execute the following command:
./gradlew :grails-core:test --tests *.BinaryPluginSpec
To run the functional tests against the current grails-core
:
-
Publish your branch to Maven Local
./gradlew publishToMavenLocal
-
Checkout the associated branch in grails-functional-tests.
-
Add
mavenLocal()
at the top of the repositories block in the rootbuild.gradle
ofgrails/grails-functional-tests
. -
Run the Functional Tests:
./gradlew build
-
Check the test results & verify that the build completes successfully.
Sometimes it's useful to debug your local application to see what's going wrong. Instead of using ./gradlew bootRun
use:
./gradlew bootRun --debug-jvm
By default, Grails forks a JVM to run the application. The -debug-jvm
argument causes the debugger to be associated with the forked JVM. You can then attach your debugger as proceed as normal.
There are many aspects to Grail's documentation:
- API documentation in the code itself via javadoc & groovydoc.
- The Grails User Guide from the grails-doc project.
- Various how-to Guides from the grails-guides project.
The user guide is written using Asciidoctor. The simplest way to contribute fixes is to simply click on the "Improve this doc" link that is to the right of each section of the documentation.
This will link to the GitHub edit screen where you can make changes, preview them and create a pull request.
If you want to make significant changes, such as changing the structure of the table of contents etc. then we recommend you build the user guide. To do that simply checkout the sources from GitHub:
$ git clone https://github.com/grails/grails-doc/
$ cd grails-doc
The source files can be found in the src/en/guide
directory. Whilst the Table of Contents (TOC) is defined in the src/en/guide/toc.yml
file.
Each YAML key points to a Asciidoc template. For example consider the following YAML:
introduction:
title: Introduction
whatsNew:
title: What's new in Grails 3.2?
...
The introduction
key points to src/en/guide/introduction.adoc
. The title
key defines the title that is dislayed in the TOC. Because whatsNew
key is nested underneath the introduction
key it points to src/en/guide/introduction/whatsNew.adoc
, which is nested in a directory called introduction
.
Essentially, using the toc.yml
file and the directory structure you can manipulate the structure of the user guide.
To generate the documentation run the publishGuide
task:
./gradlew publishGuide -x apiDocs
NOTE: In the above example we skip the apiDocs
task to speed up building of the guide, otherwise all Groovydoc documentation will be built too!
Once the guide is built simply open the build/docs/index.html
file in a browser to review your changes.
Grails code style mostly mirrors the Spring Framework's Style Guide. We are currently working on a more detailed proposal under ticket #13754.
Grails makes use of Release Drafter to draft its release notes so commit messages are important. They should follow the project's rules. While a change can be incrementally made under many commits, pull requests should be squashed into a single, meaningful commit message.
For people willing to contribute more than an occasional pull request, consider joining our core team. Inquire in the questions
channel in slack to learn more.