[Engine-devel] Improve classpath building

Juan Hernandez jhernand at redhat.com
Thu Jun 7 11:43:46 UTC 2012


On 06/05/2012 02:53 PM, Juan Hernandez wrote:
> Hello all,
>
> I would like to propose an improvement in the way we build class-paths
> in the tools associated to the engine. At the moment we have at least
> two different ways to build classpaths:
>
> 1. Hard coded in the scripts, with maybe some variables:
>
> CP=$EAR_LIB/engine-encryptutils.jar:$EAR_LIB/engine-compat.jar:...
>
> This depends a lot on where we place the jar files, and we need to place
> them in different places in different environments if we want to adhere
> to common packaging practices.
>
> 2. Use the build-classpath script:
>
> CP=`build-classpath engine-encryptutils engine-compat ...`
>
> This depends less on the place we put them, but it doesn't work in
> development environments where some jars are not installed to the proper
> system locations.
>
> None of these is good for all environments.
>
> I would like to replace this classpath building logic with an script
> that performs the task in an smarter way and that works in all our
> environments (production, development, Fedora, RHEL, etc).
>
> My proposal is to create a "engine-java" script that we should use
> always when invoking java programs. This script will receive the same
> parameters that the "java" launcher receives, but the "-cp" or
> "-classpath" options will contain not the absolute name of the jar
> files, but just a simple jar name instead, something like
> "commons-logging", "commons-codec" or "engineencryptutils". The script
> will extract the "-cp" or "-classpath" options given and use them to do
> a search of the jar files in the locations where they can be in
> different environments:
>
> /usr/share/java
> /usr/share/java/ovirt-engine
> /usr/share/ovirt-engine/engine.ear
> /usr/share/ovirt-engine/engine.ear/lib
> <your jboss development installation>/engine.ear
> <your jboss development installation>/engine.ear/lib
>
> In addition the script will check that all the give jar files exist and
> will abort the execution if any of them is missing.
>
> Find attached the initial version of the proposed script.
>
> Let me know what you think.
>
> Regards,
> Juan Hernandez
>

I submitted the following draft to gerrit, in case you want to take a 
look at the current state of the script:

http://gerrit.ovirt.org/#/c/5129

-- 
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta 
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.



More information about the Devel mailing list