Plugins in JBStrap
- Geographical map
How to Use and Create JBStrap plugins
The JBStrap framework comes with numerous features that offer you complete solutions, but you may need to develop specific solutions for your application. You can create a solution within your application for this, but if you want to re-use the same solution later, in other applications, you should create a JBStrap plugin. You can use plugins anytime, across many applications. It is also easier to maintain, as you only have to fix potential problems in a simple plugin, not in an entire application.
Loading a plugin into the application
Plugins used by the application must be listed among the application dependencies in the pom.xml file, as defined by Maven. After this, the classes within the plugin can be accessed in your application’s source code.
When specifying dependencies, you must know the plugin’s groupid, artifactid and version number. Specify these, following the example above. This code snippet must be placed in the pom.xml file, in the dependencies tag, after the other dependency tags that were already there.
If you developed the plugin yourself, the created war or jar file must be placed in the local maven repository when specifying the dependencies, otherwise the dependencies will not be found. You can do this by the created plugin with the
command, which must be issued in the root folder of the plugin project.
If the plugins dependency was specified in the pom.xml , the plugin must be loaded into the framework as well:
The plugin must be loaded in the project’s Startup class, with the loadPlugins method. When the plugin is loaded, it is also initialized, and the plugin will be fully operational in the framework.