Setting up Eclipse for FunctionalJ

Make use of FunctionalJ types with Eclipse IDE.

Introduction

FunctionalJ brings algebriac data types to Java. It does this using annotation processing and code generation. This mecahnism works will with build system like Maven and Gradle without any additional actions. However, there are steps needed to make IDE picks up the generated code. This article show what do you need to do to using FunctionalJ types on Eclipse.

VDO version on Youtube

Prerequisite

It is quite simple to set up Eclipse for the annotation processor. The easiest way is to clone an example project ( here ). Then you can import it to Eclipse as a Gradle project. This will import the necessary jar file to your local M2 folder. Then you follow the following step to tell Eclipse to use the custom annotation processor.

Setting up

  1. Click right on the project and select "Properties"
    Step 1 - Project Properties
  2. Expand "Java Compiler" and select "Annotation Processing"
  3. Make sure to check the following options
    • Enable project specific settings
    • Enable annotation processing
    • Enable processing in editor
    Then click "Apply"
    Step 2 - Annotation Processing
  4. Eaxpand "Annotation Processing" and select "Factory Path"
  5. Make sure to check the following options
    • Enable project specific settings
    Then click "Apply"
    Step 3 - Factory Path
  6. Click "Add Variable ..."
  7. Select "M2_REPO" and click "OK"
    Step 4 - Select M2_REPO
  8. Double click the newly created item "M2_REPO"
  9. Type in the path to the functionalj-types jar file or just copy this one:
    "M2_REPO/functionalj/functionalj-types/0.1.65.0/functionalj-types-0.1.65.0.jar"
    NOTE: Make sure that the version match the one in "build.gradle".
    Step 5 - Jar file path
  10. Click "Apply and Close"

You may click the below GIF to see the above steps animated.

Animated GIF of all setup steps

That is all! Once it is setup, you can now use FunctionalJ types. If you update FunctionalJ, you should update it in the factory too (Step 9). If you have any problems or questions, let me know.

Happy coding!
Nawa Man

Comments

Thank you for keeping the comment section positive, constructive and respectful. I appreciate constructive criticism & respectful disagreement!

0 / 5000