While adding log4j to my own RCP application, I came across many issues (Surely I will discuss in the coming posts how to add log4j to a RCP application), but one them was that- I was not using feature based RCP application. My application was pure plugin based, and so was the product.
And, I also simply added log4j.properties in file in the root folder of the feature project.
After this stage, the feature project is completed. But, we need to cerate feature-based product of the plugin-based RCP application too so that we can export that. Before that, if you already do not know how to create a product for RCP application, please check this post - Export RCP application as product .
So, now let's create a new product.
Step 1: Create a new product configuration.
Step 2: Go to overview tab. Select features in Product definition section.
Step 3: Select application and product.
Step 4: Go to Dependencies Tab. Click on Add your feature project you just created.. Then save.
Step 5: Now, export the product as Usual.
Step 6: Open the exported product, you will see your exported file in the root folder.
But, for using log4j in the application, it was a must that I export log4j.properties in the exported product. While doing that, I came to know that it is impossible to customize the export process . In simple words, it is not possible to export some custom file while exporting a RCP plugin based product.
So, I switched to feature based RCP application. It seemed to me at the beginning that it's a heck of work, but, later I realized it will hardly take 10 minutes to do this. Before that, if you are not sure how to create RCP application, check this post - Create a Simple RCP Application
So, let's start!!
Step 1: Create a new feature project. Click File -> New -> Other -> Plugin-Development -> Feature Project.
Step 2: Click on Next and Provide a project name and leave all the other locations as it is.
Step 3. Click in Finish. A project is now generated with 2 files in it.
- build.properties.
- feature.xml
Step 4. Open the feautre.xml file and go to Plug-ins tab. In Plug-ins and fragments section, add the Plug-in based RCP application. The name of my RCP plugin application was EditorApp. So, I added that.
Step 5. Open feature.xml as a XML document. It will look like this now -
<?xml version="1.0" encoding="UTF-8"?> <feature id="MyFeature" label="MyFeature" version="1.0.0.qualifier"> <description url="http://www.example.com/description"> [Enter Feature Description here.] </description> <copyright url="http://www.example.com/copyright"> [Enter Copyright Description here.] </copyright> <license url="http://www.example.com/license"> [Enter License Description here.] </license> <plugin id="EditorApp" download-size="0" install-size="0" version="0.0.0" unpack="false"/> </feature>
Step 6: In my case, I wanted to export a properties file to my main root folder for the exported product. So, I added the following lines to the build.properties of the feature project
bin.includes = feature.xml root=file:log4j.properties
And, I also simply added log4j.properties in file in the root folder of the feature project.
After this stage, the feature project is completed. But, we need to cerate feature-based product of the plugin-based RCP application too so that we can export that. Before that, if you already do not know how to create a product for RCP application, please check this post - Export RCP application as product .
So, now let's create a new product.
Step 1: Create a new product configuration.
Step 2: Go to overview tab. Select features in Product definition section.
Step 3: Select application and product.
Step 4: Go to Dependencies Tab. Click on Add your feature project you just created.. Then save.
Step 5: Now, export the product as Usual.
Step 6: Open the exported product, you will see your exported file in the root folder.
No comments :
Post a Comment