[Engine-devel] Improve classpath building

Yair Zaslavsky yzaslavs at redhat.com
Tue Jun 5 14:41:24 UTC 2012


On 06/05/2012 03: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.

Excellent idea!
I would like to add -
I already saw the work you did on engine-manage-domains.
When we work on development machines, we might have the jars reside in
different places.
I wanted to create a script that will allow for example to use
build-classpath on spring-ldap-core, but I did not have a soft link for
that in /usr/share/java (is that what I needed to do?)
I guess we will have to differentiate between the need of dev and
production for this script.



> 
> Regards,
> Juan Hernandez
> 
> 
> 
> _______________________________________________
> Engine-devel mailing list
> Engine-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/engine-devel




More information about the Devel mailing list