xtext/maven-xtext-example

Include .hero and .xtend files to the generated jar

victornoel opened this issue · 2 comments

Hi,

When producing a .jar with mvn package, it seems that the .hero and the .xtend files are not included in it, only the generated one.

I'm wondering if there is a way to keep it there, either done by the maven xtext plugin, or as a configuration in the example-project project pom.

Strangely, the xtend files are present in the plugin my.mavenized.herolanguage generated jars...

Hi, so I did some test with that, and for now the best I could do is the following, in the pom.xml en example-project:

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.7</version>
            <executions>
                <execution>
                    <id>add-source</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>add-source</goal>
                    </goals>
                    <configuration>
                        <sources>
                            <source>mydsl-gen</source>
                        </sources>
                    </configuration>
                </execution>
                <execution>
                    <!-- Needed so that .mydsl files are included in the jar -->
                    <id>add-resource</id>
                    <goals>
                        <goal>add-resource</goal>
                    </goals>
                    <configuration>
                        <resources>
                            <resource>
                                <directory>${project.build.sourceDirectory}</directory>
                                <includes>
                                    <include>**/*.mydsl</include>
                                </includes>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

Hi,

Actually, I consider that it is not needed to include such files in the jar because there is no need for them to be parsed to make reference from an hero or an xtend file.

I developed a dsl where I needed to reference elements declared in another model and the generated code was not enough for that so the original model was needed. In that case it was needed to distribute the original model with the generated code.

I thus close this issue.