On 1/20/2011 2:52 AM, Lawrence Jett wrote:
> Instead of creating the jar file with Ant (non-Ant guru here), I read
> where you can jar all the classes through a list file (txt):
>
> From codebase (d:\ptc\Windchill_9.1\Windchill\codebase):
>
> dir /s /b *.class>class.list
>
> jar cf wc_codebase.jar @class.list
>
> I'm still waiting to see if it works.
@class.list works fine -- that's how MakeJar.xml builds jars (even
though it's an Ant script it still uses jar to do the jar stuff for
various reasons).
That said, you need ensure each entry in @class.list is a *relative*
path from codebase, e.g. com\ptc\core\foo.class, not
D:\ptc\Windchill\codebase\com\ptc\core\foo.class. Figure out how to get
relative rather than absolute paths and you're all set. A quick look at
dir /? and I don't see how -- but I could be missing things. Using
Cygwin and skipping to good 'ole UNIX commands and you certainly could
have it quick enough.
> My question is, if you created a list that included all jars & classes
> (into one jar) under codebase, would the IDE (eclipse in particular)
> be able to see all classes within the jars that were collected into
> the main jar (as above with wc_codebase.jar).
IDEs won't see jars within a jar as being part of the classpath.
> Then I thought about doing the same thing from parent folder
> (d:\ptc\Windchill_9.1\Windchill), so it would catch WEB-INF, srclib,
> ant, Upgrade, prog_examples, etc.
>
> Not sure, but I think srclib & codebase have duplicate &
> different/separate classes (wt & com classes, stored in scrlib jars).
You almost certainly want essentially the same classpath the Windchill
server uses -- just using a jar of codebase classes rather than
codebase. So you'll want to collect all classes from codebase into a
jar as you're attempting above but use separate IDE project classpath
entries for the jars in codebase/WEB-INF/lib and WT_HOME/lib. As with
Windchill itself the entries should be codebase (or its jar
representation), then codebase/WEB-INF/lib jars and finally WT_HOME/lib
jars.
srclib is duplicate -- and exists if you really wanted your code to only
reference specific Windchill modules -- though that seems unlikely.
> So I guess I have 2 questions.
>
> 1) Will the IDE (eclipse) see the classes within the multiple jars,
> that are within the main jar?
Not to the best of my knowledge.
> If I cant jar all classes & jars into one main jar, can the gurus
> point out the jars in the attached list that should be added to my IDE
> Project Libraries?
See above.
--
Jess Holle