12 Development Setup
ljacqu edited this page 2022-01-30 10:36:17 +01:00

Some tips and recommendations for people who want to work on AuthMe.

Maven

For local development, you can enable the profile "skipLongHashTests". This disables some of the hash algorithm tests and shaves off a substantial amount of time from the build time.

IntelliJ

  • Make sure you are running idea64.exe if on a 64-bit operating system (faster).

  • Maven: if asked to enable auto-import, select it. This will update your dependencies automatically when they are changed in the pom.xml

  • If @Inject fields are marked with the "never declared" warning, go to Settings > search "unused declaration," select the Java one and press the button "Configure annotations." Add @Inject and @InjectDelayed.

  • You can make issue numbers in commit messages clickable by going to Settings > search "issue navigation", add a new rule:

Issue ID: #(\d+)
Issue link: https://github.com/AuthMe/AuthMeReloaded/issues/$1
  • Do you get an error message "missing argLine" when trying to run unit tests? Go to settings > search "Running Tests" and uncheck "argLine"

Checkstyle

IntelliJ has a checkstyle plugin that nicely couples with our use of Code Climate. With the plugin you can perform the same validations in your IDE as is done on remotely on Code Climate.

  • Ctrl+Shift+A, type "Plugins" and search for "Checkstyle". If it doesn't appear click on "Search repositories."
  • Install Checkstyle-IDEA
  • In File > Settings > Tools > Checkstyle, add the configuration file (.checkstyle.xml). Don't forget to check the "Active" checkbox.

After this, checkstyle will automatically run on your IDE and rule violations will be shown as warnings.

Unit-Tests

Some tests require an English language configuration. If your operation system language is something different than English and you're running the tests inside the IDE, some tests can fail, because the output for localized text formatting (i.e. date, time) can be different than the expected one.

  • Go to Run -> "Edit-Configurations..."
  • Click on Defaults -> JUnit
  • Add -Duser.language=en to VM Options. All new test configurations will reflect this setting.

Forking AuthMe

  • Tip: add the AuthMe repository which you've forked from to Git. Execute in console: git remote add upstream https://github.com/AuthMe/AuthMeReloaded.git. In IntelliJ use Ctrl+Shift+A > "fetch" and you will see the branches of your repository as well as of the AuthMe-Team.

  • Do not commit any changes to your master. Use it only to keep in sync with the upstream repo. This way you can always pull new changes from the parent repo into your local master without any conflicts. Then you can merge your local master with your custom branches to keep them up to date.

    • If you commit changes to your fork's master directly, you will generate a merge commit every time you pull new changes from AuthMe/AuthMeReloaded into your local master. This creates unnecessary noise in the Git history and generates ugly pull requests.

Debugging AuthMe in IntelliJ (outdated)

See Run Configuration to Debug Bukkit/Minecraft Plugin in IntelliJ IDEA on StackOverflow.

If you get ClassDefNotFoundError, make sure you extract all dependencies into the JAR. Right-click the dependencies on the right and select "Extract Into Output Root." Then move them inside the JAR file.

Screenshot dependencies setup

Run the server with VM option -Dbstats.relocatecheck=false to avoid bStats from throwing an error because it isn't relocated in the locally built JAR.