Vaadin 7 Widgset Compilation : My Brain HURTS!

Hi,

I’ve developed some client-side components and extensions in a separate (standalone) project and - using the IntelliJ plugin, everything compiles just lovely.

I now need to incorporate these components into our main project. I want (and need) to keep the source as part of the main source tree, and to be compiled as
part of our main ant build. I’ve copied the source and support files across into the main project.

Now, I cannot use IVY for real as mentioned elsewhere - however, I was getting nowhere fast. So - as an interim stop gap, I’ve been trying to compile the
widgset using IVY. Here follows an extract of the my current ant tasks, and the GWT Compile step. I’ve used ant’s VERBOSE mode (so-as to show it’s classpath)

Could anyone please give me a steer on this? I’ve spent about 2 working days on this, and it’s really confusing me! I wonder if the javax.validation.Constraint
complaint might be a pointer to the problem : validation-.jar is on the classpath, according to the verbose output.

Yours in end-of-day-hair-tearing-out-exasperation,

Charles.

<ivy:resolve file="${build-support.dir}/download-vaadin-dependencies/ivy.xml" />
  <ivy:cachepath pathid="ivy.deps.default" conf="default" />
  <ivy:cachepath pathid="ivy.deps.widgetset" conf="widgetset-compile" />
  <ivy:cachefileset setid="ivy.deps.default.fileset" conf="default"/>

  <property name="client-side-destination" value="${build.web.dir}/VAADIN/widgetsets"/>


  <target name="clean">
    <delete dir="${client-side-destination}/${widgetset}/"/>
  </target>

  <target name="generate-widgetset" description="Generates GWT widgetset XML and javascript for Vaadin, if necessary">
    <mkdir dir="${build.web.dir}"/>
    <delete dir="${client-side-destination}"/>
    <java classname="com.google.gwt.dev.Compiler" failonerror="yes" fork="yes">
      <arg value="-war"/>
      <arg value="${client-side-destination}"/>
      <arg value="${widgetset}"/>
      <!--<arg value="-logLevel"/>-->
      <!--<arg value="DEBUG"/>-->
      <arg value="-strict"/>
      <jvmarg value="-Xmx1024M"/>
      <jvmarg value="-Xss512M"/>
      <jvmarg value="-Djava.awt.headless=true"/>
      <jvmarg value="-Dgwt.usearchives=false"/>

      <classpath>
        <pathelement path="${src.dir}"/>

        <path refid="ivy.deps.widgetset"/>

        <pathelement path="${custom.classes.dir}"/>

        <fileset dir="${aura.dir}/lib/runtime">
          <include name="**/*.jar"/>
          <exclude name="**/vaadin-*.jar"/>
        </fileset>

      </classpath>

    </java>

  </target>

Ant Ouput

generate-widgetset:
    [mkdir]
 Skipping D:\Workspaces\git\aura\aura\web because it already exists.
     [java]
 Executing 'C:\java\jdk\jdk1.6.0_32\jre\bin\java.exe' with arguments:
     [java]
 '-Xmx1024M'
     [java]
 '-Xss512M'
     [java]
 '-Djava.awt.headless=true'
     [java]
 '-Dgwt.usearchives=false'
     [java]
 '-classpath'
     [java]
 'D:\Workspaces\git\aura\aura\src\main;C:\Users\Charles\.ivy2\cache\com.vaadin\vaadin-themes\jars\vaadin-themes-7.0.5.jar;C:\Users\Charles\.ivy2\cache\com.vaadin\vaadin-client-compiled\jars\vaadin-client-compiled-7.0.5.jar;C:\Users\Charles\.ivy2\cache\com.vaadin\vaadin-client\javadocs\vaadin-client-7.0.5-javadoc.jar;C:\Users\Charles\.ivy2\cache\com.vaadin\vaadin-client\jars\vaadin-client-7.0.5.jar;C:\Users\Charles\.ivy2\cache\com.vaadin\vaadin-client\sources\vaadin-client-7.0.5-sources.jar;C:\Users\Charles\.ivy2\cache\com.vaadin\vaadin-shared\jars\vaadin-shared-7.0.5.jar;C:\Users\Charles\.ivy2\cache\com.vaadin\vaadin-shared-deps\jars\vaadin-shared-deps-1.0.2.jar;C:\Users\Charles\.ivy2\cache\com.vaadin\vaadin-server\jars\vaadin-server-7.0.5.jar;C:\Users\Charles\.ivy2\cache\com.vaadin\vaadin-theme-compiler\jars\vaadin-theme-compiler-7.0.5.jar;C:\Users\Charles\.ivy2\cache\org.apache.commons\commons-jexl\jars\commons-jexl-2.1.1.jar;C:\Users\Charles\.ivy2\cache\commons-logging\commons-logging\jars\commons-logging-1.1.1.jar;C:\Users\Charles\.ivy2\cache\org.w3c.css\sac\jars\sac-1.3.jar;C:\Users\Charles\.ivy2\cache\net.sourceforge.cssparser\cssparser\jars\cssparser-0.9.5.jar;C:\Users\Charles\.ivy2\cache\commons-cli\commons-cli\jars\commons-cli-1.2.jar;C:\Users\Charles\.ivy2\cache\org.jsoup\jsoup\jars\jsoup-1.6.3.jar;C:\Users\Charles\.ivy2\cache\javax.validation\validation-api\jars\validation-api-1.0.0.GA-sources.jar;C:\Users\Charles\.ivy2\cache\com.vaadin\vaadin-client-compiler\jars\vaadin-client-compiler-7.0.5.jar;C:\Users\Charles\.ivy2\cache\commons-collections\commons-collections\jars\commons-collections-3.1.jar;C:\Users\Charles\.ivy2\cache\ant\ant\jars\ant-1.6.5.jar;C:\Users\Charles\.ivy2\cache\ant\ant-launcher\jars\ant-launcher-1.6.5.jar;C:\Users\Charles\.ivy2\cache\org.mortbay.jetty\jetty\jars\jetty-6.1.11.jar;C:\Users\Charles\.ivy2\cache\org.mortbay.jetty\jetty-util\jars\jetty-util-6.1.11.jar;C:\Users\Charles\.ivy2\cache\org.mortbay.jetty\servlet-api-2.5\jars\servlet-api-2.5-6.1.11.jar;C:\Users\Charles\.ivy2\cache\org.jdesktop\swing-worker\jars\swing-worker-1.1.jar;C:\Users\Charles\.ivy2\cache\commons-codec\commons-codec\jars\commons-codec-1.3.jar;C:\Users\Charles\.ivy2\cache\commons-io\commons-io\jars\commons-io-1.4.jar;C:\Users\Charles\.ivy2\cache\commons-lang\commons-lang\jars\commons-lang-2.6.jar;C:\Users\Charles\.ivy2\cache\org.apache.james\apache-mime4j\jars\apache-mime4j-0.6.jar;D:\Workspaces\git\aura\output\production\aquarius_aura;D:\Workspaces\git\aura\aura\lib\runtime\PortalLayout-2.0.alpha5.jar;D:\Workspaces\git\aura\aura\lib\runtime\TableExport-1.4.0.jar;D:\Workspaces\git\aura\aura\lib\runtime\activemq-pool-5.5.0.jar;D:\Workspaces\git\aura\aura\lib\runtime\animator-1.7.3.jar;D:\Workspaces\git\aura\aura\lib\runtime\aopalliance-1.0.jar;D:\Workspaces\git\aura\aura\lib\runtime\aspectjrt.jar;D:\Workspaces\git\aura\aura\lib\runtime\aspectjweaver.jar;D:\Workspaces\git\aura\aura\lib\runtime\cglib-nodep-2.2.jar;D:\Workspaces\git\aura\aura\lib\runtime\commons-cli-1.2.jar;D:\Workspaces\git\aura\aura\lib\runtime\commons-jexl-2.1.1.jar;D:\Workspaces\git\aura\aura\lib\runtime\commons-logging-1.1.1.jar;D:\Workspaces\git\aura\aura\lib\runtime\confirmdialog-2.0.4.jar;D:\Workspaces\git\aura\aura\lib\runtime\cssparser-0.9.5.jar;D:\Workspaces\git\aura\aura\lib\runtime\csstools-0.2.jar;D:\Workspaces\git\aura\aura\lib\runtime\customfield-1.0.0.jar;D:\Workspaces\git\aura\aura\lib\runtime\easyuploads-0.5.1.jar;D:\Workspaces\git\aura\aura\lib\runtime\easyuploads-7.0.0.jar;D:\Workspaces\git\aura\aura\lib\runtime\invientcharts-0.8.6.jar;D:\Workspaces\git\aura\aura\lib\runtime\js-1.6R7.jar;D:\Workspaces\git\aura\aura\lib\runtime\jsoup-1.6.3.jar;D:\Workspaces\git\aura\aura\lib\runtime\lesscss-engine-1.3.3.jar;D:\Workspaces\git\aura\aura\lib\runtime\lesscss-servlet-1.3.3.jar;D:\Workspaces\git\aura\aura\lib\runtime\notifique-1.0.5.jar;D:\Workspaces\git\aura\aura\lib\runtime\org.springframework.aop-3.0.4.RELEASE.jar;D:\Workspaces\git\aura\aura\lib\runtime\org.springframework.aspects-3.0.4.RELEASE.jar;D:\Workspaces\git\aura\aura\lib\runtime\org.springframework.jms-3.0.4.RELEASE.jar;D:\Workspaces\git\aura\aura\lib\runtime\org.springframework.web-3.0.4.RELEASE.jar;D:\Workspaces\git\aura\aura\lib\runtime\overlays-0.9.8.jar;D:\Workspaces\git\aura\aura\lib\runtime\popupbutton-2.2.0.jar;D:\Workspaces\git\aura\aura\lib\runtime\refresher-1.1.1.jar;D:\Workspaces\git\aura\aura\lib\runtime\sac-1.3.jar;D:\Workspaces\git\aura\aura\lib\runtime\splitbutton-0.9.7.jar;D:\Workspaces\git\aura\aura\lib\runtime\weelayout-0.2.2.jar;D:\Workspaces\git\aura\aura\lib\runtime\yuicompressor-2.3.6.jar'
     [java]
 'com.google.gwt.dev.Compiler'
     [java]
 '-war'
     [java]
 'D:\Workspaces\git\aura\aura/web/VAADIN/widgetsets'
     [java]
 'com.hpdsoftware.aquarius.aura.framework.vaadin.ui.component.AuraWidgetset'
     [java]
 '-strict'
     [java]
 
     [java]
 The ' characters around the executable and arguments are
     [java]
 not part of the command.
     [java]
 Compiling module com.hpdsoftware.aquarius.aura.framework.vaadin.ui.component.AuraWidgetset
     [java]
    Validating units:
     [java]
       [ERROR]
 Errors in 'file:/D:/Workspaces/git/aura/aura/src/main/com/hpdsoftware/aquarius/aura/framework/vaadin/ui/component/client/connector/MaskedTextFieldConnector.java'
     [java]
          [ERROR]
 Line 6: The import com.hpdsoftware.aquarius.aura.framework.vaadin.ui.component.MaskedTextField cannot be resolved
     [java]
          [ERROR]
 Line 18: MaskedTextField cannot be resolved to a type
     [java]
          [ERROR]
 Line 18: Class<MaskedTextField> cannot be resolved to a type
     [java]
       [ERROR]
 Errors in 'file:/D:/Workspaces/git/aura/aura/src/main/com/hpdsoftware/aquarius/aura/framework/vaadin/ui/component/client/connector/NumericCharactersExtensionConnector.java'
     [java]
          [ERROR]
 Line 9: The import com.hpdsoftware.aquarius.aura.framework.vaadin.ui.component.NumericCharactersExtension cannot be resolved
     [java]
          [ERROR]
 Line 20: NumericCharactersExtension cannot be resolved to a type
     [java]
          [ERROR]
 Line 20: Class<NumericCharactersExtension> cannot be resolved to a type
     [java]
       [ERROR]
 Errors in 'file:/D:/Workspaces/git/aura/aura/src/main/com/hpdsoftware/aquarius/aura/framework/vaadin/ui/component/client/connector/NumericReferenceFieldConnector.java'
     [java]
          [ERROR]
 Line 6: The import com.hpdsoftware.aquarius.aura.framework.vaadin.ui.component.NumericReferenceField cannot be resolved
     [java]
          [ERROR]
 Line 15: NumericReferenceField cannot be resolved to a type
     [java]
          [ERROR]
 Line 15: Class<NumericReferenceField> cannot be resolved to a type
     [java]
       [ERROR]
 Errors in 'file:/D:/Workspaces/git/aura/aura/src/main/com/hpdsoftware/aquarius/aura/framework/vaadin/ui/component/client/connector/NumericTextFieldConnector.java'
     [java]
          [ERROR]
 Line 6: The import com.hpdsoftware.aquarius.aura.framework.vaadin.ui.component.NumericTextField cannot be resolved
     [java]
          [ERROR]
 Line 19: NumericTextField cannot be resolved to a type
     [java]
          [ERROR]
 Line 19: Class<NumericTextField> cannot be resolved to a type
     [java]
    Resolving com.google.gwt.validation.client.constraints.AbstractDecimalMaxValidator
     [java]
       Found type 'com.google.gwt.validation.client.constraints.AbstractDecimalMaxValidator'
     [java]
          Found type 'javax.validation.constraints.DecimalMax'
     [java]
             [WARN]
 Detected warnings related to 'javax.validation.Constraint'.   Is validation-<version>.jar on the classpath?
     [java]
             Specify -logLevel DEBUG to see all errors.
     [java]
             [WARN]
 Ignoring unresolvable annotation type javax.validation.Constraint
     [java]
    [ERROR]
 Aborting compile due to errors in some input files

Not certain, but you might need compiled versions of the server side classes MaskedTextField etc. on the classpath. Their contents are not included in the client side code, but processing the import and the annotation in the GWT compiler might nevertheless require the class files to be available.

I’m assuming here that the only reference to those classes from your Connector class is the @Connect annotation.

Most likely the validation JAR issue does not block your compilation - at least it won’t if you remove the “-strict” parameter.

The compiled versions of the server side masses are indeed on the classpath (in directory D:\Workspaces\git\aura\output\production\aquarius_aura, which shows up in the log above).

The reference to the server side classes are just in the annotation - the source for the MaskedTextFieldConnector is below.

I’ve added some whichresource tasks to my ant build, and can confirm that both the source AND the classes for MaskedTextFieldConnector are on the classpath being used for the widgetset compilation.

As for the validation JAR issue - you are right, it doesn’t block the compilation when I drop the -strict parameter, but I am assuming (naively?) that this might be a pointer to the underlying problem (viz: the source to the javax.validation.* can be found in the validation-api-1.0.0.GA-sources.jar from the ivy cache, which is on the classpath,

[Time Passes]

Ah - by explicitly adding the validation-api-1.0.0.GA.jar (i.e. containing the compiled classes) to the classpath, I can eliminate the validation JAR issue - i.e. it appears that widgset compilation needs to have the classes for the validation on the path, which doesn’t appear to happen via the ivy configuration.

Edited to add : the javax.validation issue was a mistake on my part - I’d removed the validation.jar accidentally from my WEB-INF/lib directory

package com.hpdsoftware.aquarius.aura.framework.vaadin.ui.component.client.connector;

import com.hpdsoftware.aquarius.aura.framework.vaadin.ui.component.MaskedTextField;
import com.hpdsoftware.aquarius.aura.framework.vaadin.ui.component.client.shared.MaskedTextFieldRpc;
import com.hpdsoftware.aquarius.aura.framework.vaadin.ui.component.client.shared.MaskedTextFieldState;
import com.hpdsoftware.aquarius.aura.framework.vaadin.ui.component.client.ui.VMaskedTextField;
import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.textfield.TextFieldConnector;
import com.vaadin.shared.ui.Connect;

/**
 * com.hpdsoftware.aquarius.aura.framework.vaadin.ui.component.client.connector.MaskedTextFieldConnector, created on 26/04/13 16:14 <p>
 * @author Charles
 */
@Connect(MaskedTextField.class)
public class MaskedTextFieldConnector extends TextFieldConnector {

  @Override
  public VMaskedTextField getWidget() {
    return (VMaskedTextField) super.getWidget();
  }

  @Override
  protected void init() {
    super.init();
    // Give the widget an RPC proxy to notify server
    MaskedTextFieldRpc rpcProxy = getRpcProxy(MaskedTextFieldRpc.class);
    getWidget().setMaskedTextFieldRpc(rpcProxy);
  }

  @Override
  public MaskedTextFieldState getState() {
    return (MaskedTextFieldState) super.getState();
  }

  @Override
  public void onStateChanged(StateChangeEvent stateChangeEvent) {
    super.onStateChanged(stateChangeEvent);
    // Pass state to the widget
    getWidget().setState(getState());
  }

}

Finally : Success!

In case anyone else comes across something similar : you must clean up the gwt-unitCache directory (at the same level as the compilation desination) before/after doing a GWT Compile. I imagine it must be caching something about the dependencies - and when the dependencies were wrong previously, the cached data was retained.

The sample ant file in the ivy-template does do this - I just didn’t notice it when copying into our ant file.

Cheers,

Charles.

Also you must clean up the gwt unitcache when you change vaadin versions. The compiler is unaware of the version change and does not know to discard the cache. So when you try to recompile the widgetset, the cached versions conflict w/ the new versions in the new jar, and the compile will fail unless you delete the cache.