Hi all,
Using the antrun plugin, I'm trying to call an ant task which is launching
the GWT compiler. This ant task is based on the Joachim work at
http://braindump.dk/tech/gwt-task-for-ant/.

Something specific with GWT is that you must include the java source
directory in your classpath before calling the compiler. Unfortunatelly, I
can add all the needed jars in my classpath (gwt-user.jar,
gwt-dev-windows.jar, my ant-compile.jar ) using dependencies, but I don't
know how to add my source directory.

I tried to build an ant reference classpath with the maven.plugin.classpath
reference and the ${project.build.sourceDirectory} variable, but in all
cases my java task tells me "Unable to find
'com/company/gwt/MyModule.gwt.xml'.

I also tried to put all my java source files inside a jar and add the
corresponding dependency, in that case the GWT compilation works ! (but it
can't be a workarround, you agree ?).

So my question is : Does Maven provide a solution to add a directory to the
maven.plugin.classpath ?

Below is my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.company.exemple</groupId>
  <artifactId>gwt-maven</artifactId>
  <packaging>war</packaging>
  <name>GWT Maven example</name>
  <version>1.0-SNAPSHOT</version>
  <url>http://maven.apache.org</url>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-dev-windows</artifactId>
            <version>1.4.61</version>
            <scope>compile</scope>
          </dependency>
          <dependency>
            <groupId>com.company.gwt</groupId>
            <artifactId>ant-compile</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>compile</scope>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <phase>process-classes</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <property name="maven_source_directory"
                  value="${project.build.sourceDirectory}" />
                <echo message="source directory:  ${maven_source_directory}"
/>
                <property name="maven_plugin_classpath"
refid="maven.plugin.classpath" />
                <echo message="maven_plugin_classpath: 
${maven_plugin_classpath}" />
                <path id="my.classpath">
                  <pathelement path="${project.build.sourceDirectory}" />
                  <path refid="maven.plugin.classpath" />
                </path>

                <taskdef name="gwtcompile"
                 
classname="com.francetelecom.clara.tool.gwt.GWTCompileTask"
                  classpathref="my.classpath" />
                <gwtcompile destdir="c:/tmp" optimize="true"
style="obfuscated">
                  <fileset dir="${maven_source_directory}">
                    <include name="**/*.gwt.xml" />
                  </fileset>
                </gwtcompile>
              </tasks>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>

    <!-- GWT Dependencies -->
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-user</artifactId>
      <version>1.4.61</version>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-servlet</artifactId>
      <version>1.4.61</version>
      <scope>runtime</scope>
    </dependency>

    <!-- GUI Dependencies -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.4</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>jsp-api</artifactId>
      <version>2.1</version>
      <scope>provided</scope>
    </dependency>

  </dependencies>

</project>
-- 
View this message in context: 
http://www.nabble.com/antrun-plugin---GWT---add-the-source-directory-to-the-classpath-tp16396056s177p16396056.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to