creating a property file builder with eclipse?

E

Elhanan

hi..

i would to like to have eclipse perform a batch file each time i save
my eclipse property file, the batch will run native2ascii program
turning my hebrew into \u codes and place it in the web-inf /classes
directory.

can i do that?
 
J

Jean-Francois Briere

Yes you can.

You could use the ANT 'native2ascii' task to be executed automatically
with Eclipse.
The following are simple steps to follow with Eclipse 3.1 and a JDK
(1.4+) already installed.

1- Start Eclipse 3.1 with a JDK (not a JRE).
To be sure, just before starting Eclipse, edit 'eclipse.ini' file in
{ECLIPSE_HOME} folder
and put in the two first lines the two following lines:

-vm
{JDK_HOME}\bin\javaw.exe

This example works for Windows.
Of course {JDK_HOME} must be change appropriately for the JDK root
folder path.

2- In yur project, make sure that all your property files :
a- are located in 'hebrew_properties' sub-folder
b- have the '.properties' file extension
c- are saved with the appropriate encoding (for instance
'ISO-8859-8' encoding).
To be sure, open each file, then 'File' / 'Properties', then
check with the 'text file encoding' section.

3- In the root of your project, create a new file that you could name:
'convert_properties.xml'
and with the following content:

<project name="convert_properties" default="convert">
<target name="convert">
<native2ascii encoding="ISO-8859-8"
src="hebrew_properties"
dest="WEB-INF/classes"
includes="**/*.properties"
/>
</target>
</project>

4- Right-click on your project, then 'Properties', select 'Builders' in
tne left, then 'New' and 'OK' ('Ant Build' is pre-selected).
Change the 'Name' field for 'convert_properties', then for
'Buildfile' click on 'Browse Workspace...' and select the
'convert_properties.xml' file.
Then click on the 'Targets' panel, in 'Auto Build:' section click on
'Set Targets...' and then 'OK' ('convert' is pre-selected).
Then click 'OK' and again 'OK'.

This should work fine and smoothly.
Of course you can change the folder names / files extensions / other
names at will.

Regards
 
E

Elhanan

thanks, i created a build.xml and wrote
<project name="properyConvert" default="convert">
<target name="convert">
<native2ascii encoding="ISO-8859-8"
includes="*.properties"
src="props"
dest="WEB-INF/classes">
</native2ascii>
</target>
</project>

at first i tried placing in the src direcoty but then i saw that
eclipse overwrote it by simply copying the original file, so i had to
set in a different directory (anyway to supress it? ).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top