This post provides a step-by-step instructions for how to import an example collection of custom modules into your Java development environment and how to export a Jar file that can be imported into Bookmap.
Step 1: Download the project
Download the Github project as a zip file and extract it:
Step 2: Prepare your Java development environment (IDE)
This is a Gradle project and can be imported into any Gradle supporting Java IDE. Here we use Eclipse Photon for demonstration. Make sure you have Java Development Kit (JDK) 8 installed. Launch Eclipse and create a workspace (not in the same folder where the project is):
Once Eclipse opened, close the "Welcome" tab
Step 3: Gradle
Make sure you have Gradle integrated into Eclipse. Go to Help->Eclipse marketplace..., search for "Buildship" and install if it wasn't installed already:
Step 4: Import the project
Click on empty space under Project Explorer and select Import:
Select Existing Gradle project, click Next and select the unzipped project folder, and click Finish:
Few seconds later you should see the project successfully loaded with all dependencies:
Step 5: Export the project as a Jar file
Before you start developing your own custom modules, let's export the existing project as a jar file and make sure it works with Bookmap. Right-click on the project, click Export, choose Jar file, and click Next:
In the next window you can uncheck the project and then select only "src/main/java" as shown below. Also, set a path and name for your Jar file and click Finish:
Congratulations! You have created a jar file with Bookmap API custom modules. Now import it into Bookmap and if everything works well, start developing your own custom modules.
Isolating your code from the demo project
At some point you'd probably wish to isolate your development from the demo project. Here are 2 simplest ways to do it while keeping the necessary API dependencies:
- Create folders / packages of your own development somewhere inside the demo project (should be somewhere under \src\main\java\...) and then export into a jar just the package that you wish to export instead of the whole project.
- Create a copy the entire demo project and then delete from it everything that you don't need. Note that eclipse still expects the top structure of the source code to be \src\main\java\, but what's inside it is up to you. If you wish to follow the java naming convention, create the structure to be like this: \src\main\java\com\bookmap\api\<your name>\<your indicator>\...