ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian DeWeese <>
Subject Re: Package Renaming Task
Date Sun, 08 Sep 2002 00:31:52 GMT

I think this is an interesting concept.  We do something very similar
to this.  But instead of renaming the packages in the source files we
rename the packages in the class files.  We've written a java program
that will recurse a directory of class files and rename the packages
and references to those classes. The only restriction is that the new
name must be the same number of characters as the old name.  For
example, we use it to rename foobar.coolgui.Widget to

We currently execute it using the "exec" task but I've been
considering turning it into an Ant task.  I didn't think there would
be much outside interest in it though.


--- Dana Cordes <> wrote:
> All,
> I've just written at task that will parse through a Java source
> tree renaming the stated packages in the java files, so you can
> then compile that files into a different tree than the files
> originally existed in.  Is this of interest to anyone?  If so, I'll
> go through the submittal process.  
> I was in need of this functionality because we run our fairly large
> java app against a DB2/400 database, and I needed to support
> multiple instances of our Java stored procedures in the single jvm
> that the RDBMS runs itself.  Each instance of our application
> needed to run a seperate set of stored procedures based on the same
> code out of CVS (for our development environment), but needed to be
> indepedant so it could be modified seperatly without affecting the
> other developers.  So, say we had a set of classes in a
> com.mycompany.database.storedprocedure package in CVS, and I need
> those files to end up in a
> myinstance.mycompany.database.storedprocedure (yes, that breaks
> package naming convention, but it's just for the purposes of
> deployment) so I could also have a
> yourinstance.mycompany.database.storedprocedure in the same space.
> Once those files are processed into a new source tree, they can be
> compiled, and packaged for immediate deployment.
> It currently takes in source directory, destination directory,
> package removal depth (number of tree levels to strip off of the
> front of the package name), and replacement package the gets
> prepended to the modified package name.  It'll process a whole tree
> of files.
> The code is well documented and ready for submittal, but I don't
> know much about jUnit so it would be a pain for me to write the
> test cases.  But if anyone else is interested in the functionality
> I'll do it.  I suppose I need to learn that sometime.
> -Dana Cordes

Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message