On Fri 12 Oct 2012 02:41:45 PM EDT, Himanshu Gahlot wrote:
Hi,

Is it possible to use the JCas generator utility in some other IDE
(IntelliJ Idea, to be specific) other than Eclipse? Something where I just
need to write the xml for the new type and the corresponding Java class
gets generated using a call to some uima class/script.

I use jcasgen along with maven in Intellij IDEA. Here are the specific snippets for maven :

[...]
<!-- Needed to compile type descriptions to java -->
<dependency>
           <groupId>org.uimafit</groupId>
           <artifactId>uimafit</artifactId>
           <version>1.4.0</version>
</dependency>
[...]
<build>
       <plugins>
           <!--
Run jcasgen on the "generate-source" phase and copy the .java in target/generated-sources/uima. Do not forget to configure the content of the "<argument>" tags to your needs.
            -->
           <plugin>
               <groupId>org.codehaus.mojo</groupId>
               <artifactId>exec-maven-plugin</artifactId>
               <version>1.2.1</version>
               <executions>
                   <execution>
                       <id>jcasgen</id>
                       <phase>generate-sources</phase>
                       <goals>
                           <goal>java</goal>
                       </goals>
                   </execution>
               </executions>
               <configuration>
<mainClass>org.uimafit.util.JCasGenPomFriendly</mainClass>
                   <arguments>
<argument>file:${project.basedir}/src/main/resources/path/to/your/types/*.xml</argument> <argument>${project.build.directory}/generated-sources/uima</argument>
                   </arguments>
               </configuration>
           </plugin>

           <!-- Adds the generated sources to the build -->
           <plugin>
               <groupId>org.codehaus.mojo</groupId>
               <artifactId>build-helper-maven-plugin</artifactId>
               <version>1.7</version>
               <executions>
                   <execution>
                       <id>add-uima-sources</id>
                       <phase>generate-sources</phase>
                       <goals>
                           <goal>add-source</goal>
                       </goals>
                       <configuration>
                           <sources>
<source>${project.build.directory}/generated-sources/uima</source>
                           </sources>
                       </configuration>
                   </execution>
               </executions>
           </plugin>
       </plugins>
</build>

Looking at jcasgen.sh, you could also call the class org.apache.uima.tools.jcasgen.Jg from a run configuration.

Hope this help,

Alexandre

--
Alexandre Patry
Ingénieur-Chercheur
http://KeaText.com

Transformez vos documents en outils de décision
<< Turn your documents into decision tools

Reply via email to