POJO generation tool for killbill-api
and killbill-plugin-api
interfaces. This tool useful for:
- Generate default getter/setter implementation for POJO interfaces
- Generate default business methods for business interfaces
- Generate builder classes to build the default implementation
- Generate Jackson's Module and Revolver classes
Use this command to build the tool mvn package shade:shade
. This will produce an uberjar at target/pojogen.jar
.
If you have a file structure like the one showing in the Usage section, then you can use the following one-line command:
mvn package shade:shade && cp target/pojogen.jar ../
This section assumes that:
- You've been working with Maven and Kill Bill project for quite some time (Read more on dependency problem)
- Have the following working directory:
.
├── pojogen.jar # The uberjar
├── api-pojos # api-pojos project root directory (source of pojogen.jar tool)
├── killbill-api # killbill-api project root directory
├── killbill-plugin-api # killbill-plugin-api project root directory
├── killbill-plugin-framework-java # killbill-plugin-framework-java project root directory
To run the tool:
java -jar pojogen.jar
.
This will run the tool with the default configuration options.
To generate POJOs for the killbill-api repo, you can run java -jar pojogen.jar
Note that this will run the command with the default configuration defined in killbill-api-config.xml
To generate POJOs for the killbill-plugin-api repo, you can run
java -jar pojogen.jar --source-project=plugin-api
. Note that this will run the command with the default configuration
defined in killbill-plugin-api-config.xml.
The --source-project
option is needed here because its default value is api
. --source-project
is also only useful if
you do not specify <sourceDirectories />
in XML configuration or --source-dirs
via the command line.
To override configuration file, you can run, java -jar pojogen.jar overridden-api-config.xml
. You can copy
killbill-api-config.xml or
killbill-plugin-api-config.xml,
put them in the same directory as pojogen.jar
, and edit configuration values as needed.
pojogen.jar
allows overriding the default configuration options. For example:
-
java -jar pojogen.jar --output-subpackage=impl
. This will:- It will override
<outputSubpackage />
fromboilerplate
toimpl
. - Generate
killbill-api
POJOs tokillbill-plugin-framework-java
. - XML configuration file is not specified, so the command above will using the default killbill-api-config.xml configuration.
- It will override
java -jar pojogen.jar --source-dirs=./killbill-plugin-api/catalog/src/main/java,./killbill-plugin-api/control/src/main/java overriden-config.xml
This will:
- Generate POJOs for only the
catalog
andcontrol
modules fromkillbill-plugin-api
. - Will use
overriden-config.xml
as the XML configuration instead of the default configuration
To understand more about the elements in the XML configuration, you can check setting doc.
Not all configuration that available in XML configuration can be overridden by command line options. You can always
check all available options via java -jar pojogen.jar --help
command.
It is possible that during generation, you will encounter maven error. This is because one or more local maven artifacts
are corrupt. You can always identify all of them, and then try to re-download them.
But if you find it confusing and too much work, you can run
mvn dependency:copy-dependencies -DoutputDirectory=../lib -Dhttps.protocols="TLSv1.2" -f ./killbill-api/pom.xml
and
use --input-dependencies=lib
to fix the problem.
Kill Bill is the leading Open-Source Subscription Billing & Payments Platform. For more information about the project, go to https://killbill.io/.