You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by José Tomás Atria <jt...@gmail.com> on 2016/02/04 21:25:10 UTC

JCasGen: Import typesystem from Maven dependency jar

Hello All,

I'm using JCasGen to generate the type system for a specific research
project. This type system is an extension of a generic type system that we
use internally in our lab.

Until now, I have been doing this by copying the XML descriptor for the
generic type system to a file in my development machine, and then including
a hard coded reference to its path in the specified type system, but I
would like to remove that hard-coded reference and reference instead the
copy of the type system description that is included in the resources of
our lab's API library, distributed over maven.

e.g. right now, my type system descriptor includes the line:

<import location="file://path/to/a/local/folder/LabTypeSystem.xml"/>

I want to remove that reference and instead pull "LabTypeSystem.xml" from
the resources contained in the jar of a maven dependency.

I tried doing this instead:

<import location="
jar:file:/path/to/maven/repo/lab/group/id/lab-api-artifact/version/
lab-api-artifact-version.jar!/desc/type/LabTypeSystem.xml"/>

(i.e. the URL I got from
doing getClass().getResource("desc/type/LabTypeSystem.xml").toString() )

but this resulted in a NullPointerException (which is surely a bug in
JCasGen...), but in any case, that would just replace one hardcoded
reference by another (i.e. to the local maven repo).

Is there any way to make JCasGen resolve resources in mavenized jars?

Hope I made myself clear...

Thanks!
jta.

-- 
entia non sunt multiplicanda praeter necessitatem

Re: JCasGen: Import typesystem from Maven dependency jar

Posted by Peter Klügl <pe...@averbis.com>.
You can also debug the maven build process with the jcasgen-maven-plugin
(at least in Eclipse)

Best,

Peter

Am 05.02.2016 um 17:41 schrieb José Tomás Atria:
> Ok, I'll produce a stack trace and file the bug report.
>
> By deploying locally, I meant running JCasGen from local sources so I can
> step through it in a debugger. The NPE occurs when using
> jcasgen-maven-plugin, and I am completely ignorant about the execution
> model of maven plugins. But I'll see if I can find out more on my own,
> don't worry. Oh, and I'm using netbeans.
>
> Best,
> jta
>
>
> On Thu, Feb 4, 2016 at 6:37 PM, Richard Eckart de Castilho <re...@apache.org>
> wrote:
>
>>> On 05.02.2016, at 00:27, José Tomás Atria <jt...@gmail.com> wrote:
>>>
>>> Thanks for the tip Richard! I can't believe I did not see that paragraph
>> in
>>> the reference guide, I read it immediately before sending my email...
>>>
>>> By the way, should that NullPointerException be looked into? I would love
>>> to give more information, but I have no idea about how to deploy maven
>>> plugins locally, so I wouldn't know how to produce a more useful bug
>>> report... Would be happy to help if given a few pointers and if it's
>> useful.
>>
>> A stack trace would be helpful. You can report this in the issue tracker at
>>
>>   https://issues.apache.org/jira/
>>
>> Use "Create", Choose "UIMA" as the product and "Core Java Framework" as
>> component,
>> enter description how to reproduce and stack trace.
>>
>> I don't think it is a huge problem that should be investigated
>> immediately, but
>> it is a good thing to at least collect and document known problems.
>>
>> Not sure what you mean by "how to deploy maven plugins locally". By
>> "plugin"
>> you mean a pre-built JAR, a locally checked out and built Maven project,
>> or an actual Maven plugin? Btw. what IDE are you using?
>>
>> Cheers,
>>
>> -- Richard
>
>
>


Re: JCasGen: Import typesystem from Maven dependency jar

Posted by José Tomás Atria <jt...@gmail.com>.
Ok, I'll produce a stack trace and file the bug report.

By deploying locally, I meant running JCasGen from local sources so I can
step through it in a debugger. The NPE occurs when using
jcasgen-maven-plugin, and I am completely ignorant about the execution
model of maven plugins. But I'll see if I can find out more on my own,
don't worry. Oh, and I'm using netbeans.

Best,
jta


On Thu, Feb 4, 2016 at 6:37 PM, Richard Eckart de Castilho <re...@apache.org>
wrote:

>
> > On 05.02.2016, at 00:27, José Tomás Atria <jt...@gmail.com> wrote:
> >
> > Thanks for the tip Richard! I can't believe I did not see that paragraph
> in
> > the reference guide, I read it immediately before sending my email...
> >
> > By the way, should that NullPointerException be looked into? I would love
> > to give more information, but I have no idea about how to deploy maven
> > plugins locally, so I wouldn't know how to produce a more useful bug
> > report... Would be happy to help if given a few pointers and if it's
> useful.
>
> A stack trace would be helpful. You can report this in the issue tracker at
>
>   https://issues.apache.org/jira/
>
> Use "Create", Choose "UIMA" as the product and "Core Java Framework" as
> component,
> enter description how to reproduce and stack trace.
>
> I don't think it is a huge problem that should be investigated
> immediately, but
> it is a good thing to at least collect and document known problems.
>
> Not sure what you mean by "how to deploy maven plugins locally". By
> "plugin"
> you mean a pre-built JAR, a locally checked out and built Maven project,
> or an actual Maven plugin? Btw. what IDE are you using?
>
> Cheers,
>
> -- Richard




-- 
entia non sunt multiplicanda praeter necessitatem

Re: JCasGen: Import typesystem from Maven dependency jar

Posted by Richard Eckart de Castilho <re...@apache.org>.
> On 05.02.2016, at 00:27, José Tomás Atria <jt...@gmail.com> wrote:
> 
> Thanks for the tip Richard! I can't believe I did not see that paragraph in
> the reference guide, I read it immediately before sending my email...
> 
> By the way, should that NullPointerException be looked into? I would love
> to give more information, but I have no idea about how to deploy maven
> plugins locally, so I wouldn't know how to produce a more useful bug
> report... Would be happy to help if given a few pointers and if it's useful.

A stack trace would be helpful. You can report this in the issue tracker at

  https://issues.apache.org/jira/

Use "Create", Choose "UIMA" as the product and "Core Java Framework" as component,
enter description how to reproduce and stack trace.

I don't think it is a huge problem that should be investigated immediately, but
it is a good thing to at least collect and document known problems.

Not sure what you mean by "how to deploy maven plugins locally". By "plugin"
you mean a pre-built JAR, a locally checked out and built Maven project, 
or an actual Maven plugin? Btw. what IDE are you using?

Cheers,

-- Richard

Re: JCasGen: Import typesystem from Maven dependency jar

Posted by José Tomás Atria <jt...@gmail.com>.
Thanks for the tip Richard! I can't believe I did not see that paragraph in
the reference guide, I read it immediately before sending my email...

By the way, should that NullPointerException be looked into? I would love
to give more information, but I have no idea about how to deploy maven
plugins locally, so I wouldn't know how to produce a more useful bug
report... Would be happy to help if given a few pointers and if it's useful.

Best,
jta

On Thu, Feb 4, 2016 at 5:26 PM, Richard Eckart de Castilho <re...@apache.org>
wrote:

> Hi,
>
> use an import-by-name that looks up the resource in the classpath, e.g.
>
>   <imports>
>     <import name="desc.type.POS"/>
>     <import name="desc.type.Morpheme"/>
>   </imports>
>
> Looks for the "desc/type/POS.xml" and "desc/type/Morpheme.xml" in the
> classpath (i.e. within your Maven dependencies).
>
> See also
> https://uima.apache.org/d/uimaj-current/references.html#ugr.ref.xml.component_descriptor.imports
>
> Cheers,
>
> -- Richard
>
> > On 04.02.2016, at 21:25, José Tomás Atria <jt...@gmail.com> wrote:
> >
> > Hello All,
> >
> > I'm using JCasGen to generate the type system for a specific research
> > project. This type system is an extension of a generic type system that
> we
> > use internally in our lab.
> >
> > Until now, I have been doing this by copying the XML descriptor for the
> > generic type system to a file in my development machine, and then
> including
> > a hard coded reference to its path in the specified type system, but I
> > would like to remove that hard-coded reference and reference instead the
> > copy of the type system description that is included in the resources of
> > our lab's API library, distributed over maven.
> >
> > e.g. right now, my type system descriptor includes the line:
> >
> > <import location="file://path/to/a/local/folder/LabTypeSystem.xml"/>
> >
> > I want to remove that reference and instead pull "LabTypeSystem.xml" from
> > the resources contained in the jar of a maven dependency.
> >
> > I tried doing this instead:
> >
> > <import location="
> > jar:file:/path/to/maven/repo/lab/group/id/lab-api-artifact/version/
> > lab-api-artifact-version.jar!/desc/type/LabTypeSystem.xml"/>
> >
> > (i.e. the URL I got from
> > doing getClass().getResource("desc/type/LabTypeSystem.xml").toString() )
> >
> > but this resulted in a NullPointerException (which is surely a bug in
> > JCasGen...), but in any case, that would just replace one hardcoded
> > reference by another (i.e. to the local maven repo).
> >
> > Is there any way to make JCasGen resolve resources in mavenized jars?
> >
> > Hope I made myself clear...
> >
> > Thanks!
> > jta.
>
>


-- 
entia non sunt multiplicanda praeter necessitatem

Re: JCasGen: Import typesystem from Maven dependency jar

Posted by Richard Eckart de Castilho <re...@apache.org>.
Hi,

use an import-by-name that looks up the resource in the classpath, e.g.

  <imports>
    <import name="desc.type.POS"/>
    <import name="desc.type.Morpheme"/>
  </imports>

Looks for the "desc/type/POS.xml" and "desc/type/Morpheme.xml" in the
classpath (i.e. within your Maven dependencies).

See also https://uima.apache.org/d/uimaj-current/references.html#ugr.ref.xml.component_descriptor.imports

Cheers,

-- Richard

> On 04.02.2016, at 21:25, José Tomás Atria <jt...@gmail.com> wrote:
> 
> Hello All,
> 
> I'm using JCasGen to generate the type system for a specific research
> project. This type system is an extension of a generic type system that we
> use internally in our lab.
> 
> Until now, I have been doing this by copying the XML descriptor for the
> generic type system to a file in my development machine, and then including
> a hard coded reference to its path in the specified type system, but I
> would like to remove that hard-coded reference and reference instead the
> copy of the type system description that is included in the resources of
> our lab's API library, distributed over maven.
> 
> e.g. right now, my type system descriptor includes the line:
> 
> <import location="file://path/to/a/local/folder/LabTypeSystem.xml"/>
> 
> I want to remove that reference and instead pull "LabTypeSystem.xml" from
> the resources contained in the jar of a maven dependency.
> 
> I tried doing this instead:
> 
> <import location="
> jar:file:/path/to/maven/repo/lab/group/id/lab-api-artifact/version/
> lab-api-artifact-version.jar!/desc/type/LabTypeSystem.xml"/>
> 
> (i.e. the URL I got from
> doing getClass().getResource("desc/type/LabTypeSystem.xml").toString() )
> 
> but this resulted in a NullPointerException (which is surely a bug in
> JCasGen...), but in any case, that would just replace one hardcoded
> reference by another (i.e. to the local maven repo).
> 
> Is there any way to make JCasGen resolve resources in mavenized jars?
> 
> Hope I made myself clear...
> 
> Thanks!
> jta.