开发者

Maven GWT plugin adding other source directories

How do I add another source directory to the maven gwt compile plugin? I have some generated code that I need to include in the compile.

If I can开发者_Go百科't, what do people suggest to get around this?


I don't know if you have looked into this, but you could use the compileSourcesArtifacts attribute to include your generated code as an external library. There is an article on setting this up in the GWT Plugin Documentation. However, this will only work if you don't need the external code to be included with your web app.

Whenever we needed to do this in the past, we used the maven-resources-plugin's copy-resources goal to copy the source code into our main package structure, and configured the maven-clean-plugin to remove the files. Because the gwt compile happens during the prepare-package phase of the build lifecycle, you would need to copy your source files into the directory before that (we bound ours to process-classes).


I put the i18n goal at the generate-resourcces phase and it worked well. It will be executed before the gwt compile.

    <plugins>
        <!-- GWT Maven Plugin-->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>2.5.0-rc1</version>
             <dependencies>
                <dependency>
                    <groupId>com.google.gwt</groupId>
                    <artifactId>gwt-user</artifactId>
                    <version>${gwtVersion}</version>
                </dependency>
                <dependency>
                    <groupId>com.google.gwt</groupId>
                    <artifactId>gwt-dev</artifactId>
                    <version>${gwtVersion}</version>
                </dependency>
                <dependency>
                    <groupId>com.google.gwt</groupId>
                    <artifactId>gwt-servlet</artifactId>
                    <version>${gwtVersion}</version>
                </dependency>
            </dependencies>

            <executions>
                **<execution>
                    <id>generate-i18n</id>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>i18n</goal>
                    </goals>
                </execution>**
                <execution>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>resources</goal>
                        <goal>compile</goal>
                        <goal>test</goal>
                        <goal>generateAsync</goal>
                    </goals>
                </execution>

            </executions>

            <configuration>
                    <!-- your config -->
            </configuration>
        </plugin>


This works because your generated output is generated in the normal source folder. But the question was how to add an extra source folder.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜