This seems good to me. Two minor ponts though:
- Is there a reason that the jars should be called *override.jar ? I'd
find it more natural if all the jars in the override directory would be
considered.
- Perhaps it would make sense to use two different build properties,
one for the jar directory, and one for the unpacked directory.
But I do not think they are crucial, so whatever seems fit to you...
Would you mind to create a patch, together with the necessary
documentation ?
As concerning Maven 2, there will be a maven2 plugin in the following
release. However, as maven 2 does not yet support class path ordering as
it seems (http://jira.codehaus.org/browse/MNG-1412), overriding would not
seem possible for maven at the moment. I'll have to check about using the
classpath in the maven 2 plugin anyway, cannot remember if it is supported
or not.
Thomas
On Fri, 4 Aug 2006, Greg Monroe wrote:
Thomas Fischer said:
I like the idea, however, I do not see that the
implementation is trivial even in ant (but maybe
you can enlighten me there). There are two ways to
support templates, the first is to look in the
classpath, the second one is to give a single
directory. Both ways are handled internally
by velocity.
How do you want to modify this behaviour?
Hmm, I'd forgotten about the non-classpath variation.
Supporting that variation probably can't be done. But
I'm not sure it's needed if there's a way to use the
classpath to override any or all templates in the
distro-jar. This is the preferred/distributed method
after all.
That said, here's the state of my thinking/testing
after including your "allow non-jar-ed template files
scenario. I was originally just thinking just jar
files, but having editable local templates would be
great for developing stuff.
First, there'll be one new optional build property,
called:
torque.override.directory
If set, this should point to a valid directory in your
project. E.g. ${torque.output.dir}/local-mods.
Any file in this directory endings in "-override.jar"
will be added to the classpath used by Torque tasks.
Also, if there is a "templates" directory, this will
be added as a directory entry (e.g. classes type entry).
These are all added prior to the distribution jar files
so the ClassLoader/ResourceLoader will find stuff here
first.
So, if you want local (or contributed) modification to
any of the generator classes or templates, just create
the directories with your jars or template files and
set the new property. Then regenerate stuff.
Below is the Ant "magic" to make this happen. FWIW, I've
learned enough about Maven 1.0 now to duplicate it
in the that script. So that's not a problem.
Thoughts about doing this in Maven 2.0? (But it's not
"officially" support it yet.. so is this a new release
condition for the folks working on this?)
------------------------------------------
<!--
Ant complains if fileset directories don't exist,
so make sure that the torque.override.dir point
to a valid directory.
Not Set Default: $torque.lib.dir value
-->
<condition property="valid.override.directory"
value="${torque.override.dir}">
<isset property="torque.override.dir" />
</condition>
<condition property="valid.override.directory"
value="${torque.lib.dir}">
<not>
<isset property="torque.override.dir" />
</not>
</condition>
<path id="torque-classpath">
<!-- Add in override directory stuff -->
<pathelement location="${valid.override.directory}/templates"/>
<fileset dir="${valid.override.directory}">
<include name="*override.jar"/>
</fileset>
<!-- Normal distro classpath info -->
<fileset dir="${torque.lib.dir}">
<include name="**/commons-collections-3.1.jar"/>
<include name="**/commons-lang-2.1.jar"/>
<include name="**/log4j-1.2.8.jar"/>
<include name="**/${torque.jar}"/>
<include name="**/velocity-1.3.1.jar"/>
<include name="**/village-2.0.jar"/>
<include name="**/xercesImpl-2.6.2.jar"/>
<include name="**/xml-apis-2.0.2.jar"/>
<include name="**/*.jar"/>
</fileset>
</path>
Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are
confidential communication or may otherwise be privileged or confidential and
are intended solely for the individual or entity to whom they are addressed.
If you are not the intended recipient you may not rely on the contents of this
email or any attachments, and we ask that you please not read, copy or
retransmit this communication, but reply to the sender and destroy the email,
its contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is strictly
prohibited.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]