2

Does someone know how we can create a new component in Apache OFBiz latest version 16.11.01. Earlier it was using ant create-component to create a component but the new version uses Gradle.

Vy Do
  • 46,709
  • 59
  • 215
  • 313
Bhupendra
  • 35
  • 6

2 Answers2

4

The new command is:

gradlew createPlugin -PpluginId=myplugin

where myplugin is the name of the new component. Please refer to the README.md file in the OFBiz home folder for further details, in the section "Create a new plugin". Once the component is created, you should load its data (required to grant access rights to the admin user); you can easily do this by loading the demo data of OFBiz with the command:

gradlew loadDefault

You can also delete the component with the command:

gradlew removePlugin -PpluginId=myplugin
Vy Do
  • 46,709
  • 59
  • 215
  • 313
  • I am able to create a component by the above command but after creating component when i am going to the component, an error is occurred as ofbiz.widget.renderer.ScreenRenderException – Bhupendra Dec 09 '16 at 14:58
  • Bruno, can you please provide a screenshot or full stacktrace? How do you access the new component? – Michael Brohl Dec 09 '16 at 15:09
  • I just checked the functionality with latest trunk and the command Jacopo provided. It works a charm (after removing the MYPLUGIN base permission in ofbiz-component.xml). – Michael Brohl Dec 09 '16 at 15:19
  • This is the error I am getting [1]: https://i.stack.imgur.com/tlaTu.png – Bhupendra Dec 09 '16 at 15:32
  • @JacopoCappellato there was a problem in uilabels. I got it done by keeping english translations and clearing all others. – Bhupendra Jan 02 '17 at 23:50
1

Plugins are standard OFBiz components that reside in the specialpurpose directory. Plugins can be added manually or fetched from a maven repository. The standard tasks for create new plugin is giving below.

To Create a new plugin. The following project parameters are passed:

  • pluginId: mandatory
  • pluginResourceName: optional, default is the Capitalized value of pluginId
  • webappName: optional, default is the value of pluginId
  • basePermission: optional, default is the UPPERCASE value of pluginId

Enter following command below to create component/plugin,

./gradlew createPlugin -PpluginId=myplugin

or

./gradlew createPlugin -PpluginId=myplugin -PpluginResourceName=MyPlugin -PwebappName=mypluginweb -PbasePermission=MYSECURITY`

The above commands achieve the following:

  • create a new plugin in /specialpurpose/myplugin
  • add the plugin to /specialpurpose/component-load.xml

Once the component is created, you should load its data (required to grant access rights to the "admin" user);

./gradlew "ofbiz --shutdown"
./gradlew loadDefault
./gradlew
./gradlew ofbiz

To know more about create component in ofbiz Create ofbiz component/plugin by gradle