gwt 2.3 gwt-servlet-deps.jar from Ant Ivy build
I am trying to get a simple GWT 2.3 project working in DevMode with an Ant Ivy build. I have used Ivy for GWT projects prior to 2.3 (GWT 2.0.x in particular), and the following dependencies (in my Ivy module xml file) have worked for me in the past: (I have removed the specific names for my Ivy configurations, and show them as "..." below.)
<dependency org="com.google.gwt" name="gwt-开发者_如何学Cdev" rev="2.3.0" conf="..." />
<dependency org="com.google.gwt" name="gwt-servlet" rev="2.3.0" conf="..." />
<dependency org="com.google.gwt" name="gwt-user" rev="2.3.0" conf="..." />
My gwt-compile (when GWT's Java-to-Javascript compiler is invoked) fails using the above under GWT 2.3, however. In particular, with several errors similar to the following:
[java] [ERROR] Errors in 'jar:file:/../gwt-user-2.3.0.jar!/com/google/gwt/editor/client/EditorDriver.java'
[java] [ERROR] Line 97: No source code is available for type javax.validation.ConstraintViolation<T>; did you forget to inherit a required module?
After searching online for references that may be relevant, I find threads like this one regarding similar problems while building release candidates of 2.3 from source. These threads frequently mention a gwt-servlet-deps.jar
that one needs to include in the compilation classpath, which appears to be the fruits of the labor around this issue in the GWT issue tracking system.
Of course with Ivy it's not quite the same as the advice I'm seeing. The above <dependency...
rules do not appear to download a gwt-servlet-deps.jar
(as opposed to downloading GWT's official distribution, wherein a special copy of that jar can be found).
So I have reasoned out that in the Ivy universe I probably need to add something like this:
<dependency org="javax.validation" name="validation-api" rev="1.0.0.GA" conf="..."/>
...and I thought I was pretty bad-ass for even having that idea (I seem to be a perpetual newbie to the Ivy & Maven world) but, alas, I am still getting the same errors.
Apparently the Java-to-Javascript compiler would like the sources, not just the bytecode jar, but I don't know how to tell Ivy to go get them. I feel like I'm close because I have found this thread which shows an Ant task that copies two validation jars into lib (both bytecode and sources), but I need some help to connect the dots for the Ivy world.
How would I tell Ivy to grab the source jar?
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"
xmlns:m="http://ant.apache.org/ivy/maven">
<dependency org="javax.validation" name="validation-api" rev="1.0.0.GA">
<artifact name="validation-api"/>
<artifact name="validation-api" m:classifier="sources"/>
</dependency>
Source: http://groups.google.com/group/google-web-toolkit/browse_thread/thread/4744e62fb088ba60?pli=1
Thanks to Filipe Sousa
If the repository is an ivy-repository (ivy.xml files for the artifacts) this answer might help:
You would need to specifiy the conf of the validation api, that includes the sources.
<dependency org="javax.validation" name="validation-api" rev="1.0.0.GA" conf="compile->sources"/>
where compile is your local configuration and sources would be the configuration for the jar with sources.
The ivy.xml for validation-api would have to look like this (I don't know what it looks like in your repository):
<configurations>
<conf name="compile" visibility="public"/>
<conf name="source" visibility="public"/>
</configurations>
<publications>
<artifact name="validation-api" type="jar" conf="compile" ext="jar"/>
<artifact name="validation-api-src" type="jar" conf="source" ext="jar"/>
</publications>
This would tell ivy that there are two jars for the validation api available. One normal one (compile) and one special one(with sources). And you would have to specify which conf to retrieve.
精彩评论