Fork me on GitHub

Generate Java Interface using the CSS Interface Generator from GWT

Starting with version 2.1.1, you can generate Java Interfaces from css files. Your css must be located in resources referenced in the Maven pom The css filename is used to generate the Java class Name (so use the standard camel case).

|_src 
  |_main 
    |_resources 
      |_bar/MyCss.css 
      |_foo/MySite.css 
<project>
  [...]
  <build>
    <plugins>
      [...]
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>2.8.0</version>
        <configuration>
          <cssFiles>
            <cssFile>bar/MyCss.css</cssFile>
            <cssFile>foo/MySite.css</cssFile>
          </cssFiles>
        </configuration>
        <executions>
          <execution>
            <id>css-generation</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>css</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      [...]
    </plugins>
  </build>
  [...]
</project>

The java sources will be generated by default in ${project.build.directory}/generated-sources/gwt . This can be changed with the generateDirectory mojo parameter.