Aaron Kaplan wrote:
> When I first started playing with UIMA, I let the eclipse plugin run
> jcasgen for me automatically whenever I changed the type system
> descriptor.  After a few days of that, I noticed that my src folder
> was full of definitions of obsolete classes, corresponding to types I
> had once defined and then either renamed or deleted.  It was a pain to
> clean them all up, because they were scattered among files that I had
> written by hand, so I had to inspect each file under src and decide
> whether to delete it or not.
>
> In order to avoid that, I now tell jcasgen to create its output in a
> separate directory, say jcasgen-src instead of src.  My ant "clean"
> target wipes out that directory.
>
> The problem with this solution is that now eclipse can't build my
> project.  As far as I can see, the jcasgen output directory can't be
> configured in the eclipse plugin.  
That's right.  But it sounds like a reasonable new feature request.  If
you wanted to fix this, I'll take a look at your patch and see about
committing it :-)

The other thing that *might* work - I believe that JCasGen uses the
"first" src folder it finds in the project.  You might try configuring
your project with additional source folders, and putting the one you
want JCasGen to use, first.  You can add src folders in the project -
properties - Java build path menu, and there is an "Order and Export"
tab where you can set the order.  If you try this, let us know if it
works :-)
> So I have to remember to run an ant task each time I change my type
> system (at least until I get around to figuring out how to write a
> custom eclipse builder).
>
> Do people have other strategies for cleaning up obsolete jcasgen output?
>
> Obviously if you modify the jcasgen output by hand, you can't use my
> strategy, otherwise "clean" would wipe out your work.  But is there
> any reason to modify the jcasgen-generated class definitions, rather
> than leaving them as they are and subclassing them?
Unfortunately, the main JCas class, not a subclass, is used by the
framework when the framework needs to create new instances.  If
"BaseJCasClass" is a base class, and you derive "SubJCasClass" from it,
you could create a new instance:
    new SubJCasClass(...)

but the framework, which also needs to sometimes create new instances
(for example, if you are iterating through the CAS and use the
iterator.next() method) - will use the BaseJCasClass because it doesn't
know about your extension..
>
> -Aaron
>
>

Reply via email to