Hi all,

I've been also a bit struggling to generate classes from type descriptors
outside Eclipse (in IntelliJ Idea, and Maven3 on command line, resp.) and
finally found a complete working solution, which not only generates the code
but also adds the generated classes to the Maven life-cycle so a complete
project can be compiled.

in pom.xml:

        <build>
                <plugins>
                        <plugin>
                                <groupId>org.apache.uima</groupId>
                                <artifactId>jcasgen-maven-plugin</artifactId>
                                <version>2.4.2</version>
                                <configuration>
                                        <typeSystemIncludes>
                                                
<include>src/main/resources/desc/types/Annotator.xml</include>
                                        
<!--<include>src/main/resources/desc/types/OtherTypeSystem.xml</include>-->
                                        </typeSystemIncludes>
                                </configuration>
                                <executions>
                                        <execution>
                                                <!--call it in the 
generate-source phase-->
                                                <phase>generate-sources</phase>
                                                <goals>
                                                        <goal>generate</goal>
                                                </goals>
                                        </execution>
                                </executions>
                        </plugin>
                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
                                
<artifactId>build-helper-maven-plugin</artifactId>
                                <version>1.8</version>
                                <executions>
                                        <execution>
                                                <id>addToSourceFolder</id>
                                                <goals>
                                                        <!--add the generated 
sources-->
                                                        <goal>add-source</goal>
                                                </goals>
                                                <phase>process-sources</phase>
                                                <configuration>
                                                        <sources>
                                                                <!--default 
path to generated sources-->
                                                                
<source>${project.build.directory}/generated-sources/jcasgen</source>
                                                        </sources>
                                                </configuration>
                                        </execution>
                                </executions>
                        </plugin>
                </plugins>
        </build>

Hope that helps someone :)

Best,

Ivan

Reply via email to