uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philip Ogren <phi...@ogren.info>
Subject Re: Automatic Generation of class files (JCasGen) from Maven
Date Wed, 30 Jun 2010 02:49:44 GMT
It turns out that the main method of org.apache.uima.tools.jcasgen.Jg 
was, in version 2.2.2, a single line of code which called a method 
called main0.  In version 2.3.0 there are two lines of code - the second 
is a call to System.exit.  This was the source of my problems and 
explains (sort of) why eclipse was actually crashing silently when I 
updated the dependency on uima in my pom.xml file to version 2.3.0.

My workaround is to simply introduce a local class whose main method 
only has the one line of code and I call that class instead.

Ramon, thanks again for the pom.xml snippet.  We actually use the 
execution phase "process-resources" or "process-test-resources" 
depending on the scenario and that seems to work fine for us.


On 6/18/2010 2:50 PM, Philip Ogren wrote:
> Hi,
> We have been using a snippet for our pom.xml file pretty much exactly 
> like the one below to run JCasGen on our type system descriptor before 
> compilation.  When I switched to 2.3.0 this doesn't work anymore.  For 
> example, when I run "mvn test", JCasGen will generate the files but 
> then maven just exits without an error message and without running the 
> tests.  If I remove this block of xml from the pom, then everything 
> works fine.
> Any thoughts about how I would go about fixing this?  Or, does anyone 
> have another snippet of xml I could insert into my pom.xml to get the 
> same behavior?
> Thanks,
> Philip
> On 7/6/2009 7:58 AM, Ramon Ziai wrote:
>> Hi,
>> just as a follow-up to this, I found a solution to this that works for
>> me. Here's the relevant POM snippet, in the hope that it will be useful
>> for others:
>> [...]
>> <plugin>
>> <groupId>org.codehaus.mojo</groupId>
>> <artifactId>exec-maven-plugin</artifactId>
>> <version>1.1</version>
>> <executions>
>> <execution>
>> <phase>validate</phase>
>> <goals>
>> <goal>java</goal>
>> </goals>
>> </execution>
>> </executions>
>> <configuration>
>> <mainClass>org.apache.uima.tools.jcasgen.Jg</mainClass>
>> <arguments>
>> <argument>-jcasgeninput</argument>
>> <argument>desc/yourTypeSystem.xml</argument>
>> <argument>-jcasgenoutput</argument>
>> <argument>src/main/java</argument>
>> </arguments>
>> </configuration>
>> </plugin>
>> [...]
>> This will run JCasGen prior to the compile phase, ensuring that build
>> dependencies are satisfied. JCasGen is run without the merge capability,
>> so manual changes to the generated Java files will be lost.
>> Best,
>> Ramon
>> Александър Л. Димитров schrieb:
>>> Hello,
>>> I'm currently working on a distributed project involving UIMA. At 
>>> this stage,
>>> sometimes modifications to the UIMA descriptor files are absolutely 
>>> necessary
>>> and, unfortunately, this confuses our VCS. Whenever JCasGen is run 
>>> from within
>>> Eclipse or similar, it updates *all* generated class files, which 
>>> leads the VCS
>>> to treating them as new commits. The problem here is, when editing the
>>> descriptors on different branches, while the merging of the 
>>> descriptor files
>>> goes well most of the time, the merging of the class files fails 
>>> most of the
>>> time. This leaves the merger with several dozen conflicts.
>>> The current policy is to then just delete those files and run 
>>> JCasGen on the
>>> merged branch. Of course, the actual problem here is, that one 
>>> shouldn't really
>>> track those files in the first place.
>>> But the matter is slightly more delicate. After checking out the 
>>> project from
>>> version control, the project should be readily compilable, without 
>>> further
>>> setup. That's why we're using Maven to fetch all dependencies and 
>>> automate the
>>> build process. Without having these files in source control, they 
>>> have to be
>>> generated first.
>>> So the real question is: is there any way to run a JCasGen from 
>>> within the Maven
>>> build? Probably a plugin? Of course, one could just spawn a process 
>>> to call
>>> org.apache.uima.tools.jcasgen.Jg, but I wanted to ask if such a 
>>> thing already
>>> existed.
>>> Thanks,
>>> Aleks
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 9.0.829 / Virus Database: 271.1.1/2946 - Release Date: 06/18/10 00:35:00

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message