You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Amit Dor-Shifer <am...@oversi.com> on 2008/05/22 13:55:15 UTC

best practice: How to insert unreferenced class files into a JAR

Hi all.
I'm using a framework of logging formatters. Those formatters are 
assigned to a log according to configuration. This means those classes 
are never imported in source code. I've came to notice this when a/m 
files weren't appended to my JAR. They are located at the 'sourcepath' 
of my project, but belong to a separate java project.

I've resolved this issue by explicitly adding the directory containing 
those files to the 'srcdir' attribute of my 'javac' task. Nevertheless, 
I'm not content with this solution and I'm guessing there's some sort of 
standard procedure to resolve such issues. Anyone using java reflection 
might stumble on the same issue, right? What's the correct way to have 
dynamically instantiated classes available at runtime, in a deployed 
environment?
Am I on the right path with this work-around?
Thanks,
Amit

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: best practice: How to insert unreferenced class files into a JAR

Posted by Vijay Aravamudhan <av...@gmail.com>.
Since these dynamically loaded classes are part of a separate project, 
you are already on the correct path. Just jar those files separately and 
use that jar in the classpath of your project. If you want to go even 
further, use ivy to manage your dependencies.

Vijay

Amit Dor-Shifer wrote:
> Hi all.
> I'm using a framework of logging formatters. Those formatters are 
> assigned to a log according to configuration. This means those classes 
> are never imported in source code. I've came to notice this when a/m 
> files weren't appended to my JAR. They are located at the 'sourcepath' 
> of my project, but belong to a separate java project.
>
> I've resolved this issue by explicitly adding the directory containing 
> those files to the 'srcdir' attribute of my 'javac' task. 
> Nevertheless, I'm not content with this solution and I'm guessing 
> there's some sort of standard procedure to resolve such issues. Anyone 
> using java reflection might stumble on the same issue, right? What's 
> the correct way to have dynamically instantiated classes available at 
> runtime, in a deployed environment?
> Am I on the right path with this work-around?
> Thanks,
> Amit
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org