Contributing to JHipster
Are you ready to contribute to JHipster? We'd love to have you on board, and we will help you as much as we can. Here are the guidelines we'd like you to follow so that we can be of more help:
- Questions and help
- Issues and Bugs
- Feature Requests
- Submission Guidelines
- Generator development setup
- Coding Rules
- Git Commit Guidelines
And don't forget we also accept financial contributions to the project using OpenCollective.
If you find a bug in the source code or a mistake in the documentation, you can help us by submitting a ticket to our GitHub issues. Even better, you can submit a Pull Request to our JHipster generator project or to our Documentation project.
Please see the Submission Guidelines below.
You can request a new feature by submitting a ticket to our GitHub issues. If you would like to implement a new feature then consider what kind of change it is:
- Major Changes that you wish to contribute to the project should be discussed first. Please open a ticket which clearly states that it is a feature request in the title and explain clearly what you want to achieve in the description, and the JHipster team will discuss with you what should be done in that ticket. You can then start working on a Pull Request.
- Small Changes can be proposed without any discussion. Open up a ticket which clearly states that it is a feature request in the title. Explain your change in the description, and you can propose a Pull Request straight away.
Before you submit your issue search the archive, maybe your question was already answered.
If your issue appears to be a bug, and has not been reported, open a new issue. Help us to maximize the effort we can spend fixing issues and adding new features, by not reporting duplicate issues. Providing the following information will increase the chances of your issue being dealt with quickly:
- Overview of the issue - if an error is being thrown a stack trace helps
- Motivation for or Use Case - explain why this is a bug for you
- Related issues - has a similar issue been reported before?
- Suggest a Fix - if you can't fix the bug yourself, perhaps you can point to what might be causing the problem (line of code or commit)
- JHipster Version(s) - is it a regression?
- JHipster configuration, a
.yo-rc.jsonfile generated in the root folder - this will help us to replicate the scenario, you can remove the rememberMe key.
- Entity configuration(s)
entityName.jsonfiles generated in the
.jhipsterdirectory - if the error is during an entity creation or associated with a specific entity
- Browsers and Operating System - is this a problem with all browsers or only IE8?
You can use
jhipster info to provide us the information we need.
You can run
jhipster info in your project folder to get most of the above required info.
Issues opened without any of these info will be closed without any explanation.
Before you submit your pull request consider the following guidelines:
Search GitHub for an open or closed Pull Request that relates to your submission.
If you want to modify the JHipster generator, read our Generator development setup
Make your changes in a new git branch
git checkout -b my-fix-branch master
Create your patch, including appropriate test cases.
Follow our Coding Rules.
Generate a new JHipster project, and ensure that all tests pass
mvn verify -Pprod
Test that the new project runs correctly:
You can also run our travis build locally by following this
Commit your changes using a descriptive commit message that follows our commit message conventions.
git commit -a
Note: the optional commit
-acommand line option will automatically "add" and "rm" edited files.
Push your branch to GitHub:
git push origin my-fix-branch
In GitHub, send a pull request to
If we suggest changes then
Make the required updates.
Re-run the JHipster tests on your sample generated project to ensure tests are still passing.
Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
git rebase master -i git push -f
That's it! Thank you for your contribution!
Resolving merge conflicts ("This branch has conflicts that must be resolved")
Sometimes your PR will have merge conflicts with the upstream repository's master branch. There are several ways to solve this but if not done correctly this can end up as a true nightmare. So here is one method that works quite well.
First, fetch the latest information from the master
git fetch upstream
Rebase your branch against the upstream/master
git rebase upstream/master
Git will stop rebasing at the first merge conflict and indicate which file is in conflict. Edit the file, resolve the conflict then
git add <the file that was in conflict> git rebase --continue
The rebase will continue up to the next conflict. Repeat the previous step until all files are merged and the rebase ends successfully.
Re-run the JHipster tests on your sample generated project to ensure tests are still passing.
Force push to your GitHub repository (this will update your Pull Request)
git push -f
After your pull request is merged
After your pull request is merged, you can safely delete your branch and pull the changes from the main (upstream) repository:
Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
git push origin --delete my-fix-branch
Check out the master branch:
git checkout master -f
Delete the local branch:
git branch -D my-fix-branch
Update your master with the latest upstream version:
git pull --ff upstream master
Here are the most important steps.
Fork the generator-jhipster project
Go to the generator-jhipster project and click on the "fork" button. You can then clone your own fork of the project, and start working on it.
Set NPM/YARN to use the cloned project
In your cloned
generator-jhipster project, type
npm link or
yarn && yarn link depending on the package manager you use.
This will do a symbolic link from the global
node_modules version to point to this folder, so when we run
jhipster, you will now use the development version of JHipster.
For testing, you will want to generate an application, and there is a specific issue here: for each application, JHipster installs a local version of itself. This is made to enable several applications to each use a specific JHipster version (application A uses JHipster 3.1.0, and application B uses JHipster 3.2.0).
To overcome this you need to run
npm link generator-jhipster or
yarn link generator-jhipster on the generated project folder as well, so that the local version has a symbolic link to the development version of JHipster.
To put it in a nutshell, you need to:
yarn linkon the
npm link generator-jhipsteror
yarn link generator-jhipsteron the generated application folder (you need to do this for each application you create)
Now, running the 'jhipster' command should run your locally installed JHipster version directly from sources. Check that the symbolic link is correct with the following command :
➜ ~ ll $(which jhipster) lrwxr-xr-x 1 username admin 63B May 15 11:03 /usr/local/bin/jhipster -> ../../../Users/username/github/generator-jhipster/cli/jhipster.js
You can test your setup by making a small change in your cloned generator, and running again on an existing JHipster project:
Depending on which parts of the generator you have changed, do not forget to run jhipster command with the proper arguments e.g. when updating the entity template run:
You should see your changes reflected in the generated project.
Use a text editor
Use a debugger
It is possible to debug JHipster's code using a Node.js debugger. To achieve this, setup your debugger to launch
Debugging with VSCode
To start debugging JHipster with VSCode, open the generator code in your workspace and simply press F5 (or click the green arrow in the Debug menu reachable with Ctrl+Shift+D). This will start the generator in debug mode and generate files in the
It is also possible to debug sub generators by selecting one of the other debug options (for example
jhipster entity). Those debug configurations are specified in the
Local Travis Build
You can run the travis builds locally by following below commands
CD into the travis folder
cd travis from the generator source code root folder
./build-samples.sh [command_name] [sample_name:optional]
This will create the travis sample project under the
travis/samples folder with folder name
[sample_name]-sample. You can open this application in your editor or IDE to check it further. You can also run tests locally on the project to verify
Sample name is optional and can be any of the folder name in the
travis/samples folder. If not specified the it will mean all samples
Command name can be as below
`list`: List all sample names `generate`: Generate the sample if specified else generate all samples `build` : Generate and test the sample if specified else generate and test all samples `clean` : Clean the generated code for the sample if specified else clean all samples
To ensure consistency throughout the source code, keep these rules in mind as you are working:
- All features or bug fixes must be tested by one or more tests.
- All files must follow the .editorconfig file located at the root of the JHipster generator project. Please note that generated projects use the same
.editorconfigfile, so that both the generator and the generated projects share the same configuration.
- Java files must be formatted using Intellij IDEA default code style.
- Any client side feature/change should be done for both Angular and react clients
- Angular Typescript files must follow the Official Angular style guide.
- React/Redux Typescript files may follow the React/Redux Typescript guide.
Please ensure to run
npm run lint and
npm test on the project root before submitting a pull request. You can also run
npm run lint-fix to fix some of the lint issues automatically.
The template engine used by yeoman is EJS, its syntax is fairly simple. For simple code (few lines), logic can be embedded in the main file but if logic becomes more complex it's better to externalise the JS fragment to a sub template included by the first one and located in same folder.
Sub templates should be named with the
ejs extension because it's the default one, it enables editors to apply correct syntax highlighting and it enables us to use a very concise syntax:
<%- include('field_validators'); -%>
Sub templates can be unit tested.
We have rules over how our git commit messages must be formatted. Please ensure to squash unnecessary commits so that your commit history is clean.
Each commit message consists of a header, a body and a footer.
<header> <BLANK LINE> <body> <BLANK LINE> <footer>
Any line of the commit message cannot be longer 100 characters! This allows the message to be easier to read on GitHub as well as in various git tools.
The Header contains a succinct description of the change:
- use the imperative, present tense: "change" not "changed" nor "changes"
- don't capitalize first letter
- no dot (.) at the end
If your change is simple, the Body is optional.
Just as in the Header, use the imperative, present tense: "change" not "changed" nor "changes". The Body should include the motivation for the change and contrast this with previous behavior.
The footer is the place to reference GitHub issues that this commit Closes.
You must use the GitHub keywords for automatically closing the issues referenced in your commit.
For example, here is a good commit message:
upgrade to Spring Boot 1.1.7 upgrade the Maven and Gradle builds to use the new Spring Boot 1.1.7, see http://spring.io/blog/2014/09/26/spring-boot-1-1-7-released Fix #1234