Using Vaadin with Maven 2

The current archetype has a slight isssue when launching jetty using mvn jetty:run.

This is a known bug with jetty and mvn. It has been documented here → http://jira.codehaus.org/browse/JETTY-680

Due to this bug, when running mvn jetty:run from the vaadin project, you get the following error…

[INFO]

[ERROR]
BUILD ERROR
[INFO]

[INFO]
Failed to configure plugin parameters for: org.mortbay.jetty:maven-jetty-plugin:6.1.19

(found static expression: 'src/main/webapp,/Users/dummy/workspace/vaadin.test/target/vaadin.test-0.0.1-SNAPSHOT' which may act as a default value).

Cause: Cannot assign configuration entry ‘resources’ to ‘class [Lorg.mortbay.resource.Resource;’ from ‘src/main/webapp,/Users/dummy/workspace/vaadin.test/target/vaadin.test-0.0.1-SNAPSHOT’, which is of type class java.lang.String

You can resolve this issue by changing the pom file as shown below… I have commented the original entry and changed it to what is shown below:

        <!-- A simple Jetty test server at http://localhost:8080/vaadin.test
             can be launched with the Maven goal jetty:run and stopped with jetty:stop -->
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <version>6.1.19</version>
            <configuration>
                <stopPort>9966</stopPort>
                <stopKey>vaadin.test</stopKey>
                <!-- Redeploy every x seconds if changes are detected, 0 for no automatic redeployment -->
                <scanIntervalSeconds>0</scanIntervalSeconds>
                <!-- make sure Jetty also finds the widgetset -->
                <webAppConfig>
                    <contextPath>/vaadin.test</contextPath>
                    <baseResource implementation="org.mortbay.resource.ResourceCollection">
                        <!--<resources>src/main/webapp,${project.build.directory}/${project.build.finalName}</resources> -->
                    	<resourcesAsCSV>src/main/webapp,${project.build.directory}/${project.build.finalName}</resourcesAsCSV>
                    </baseResource>
                </webAppConfig>
            </configuration>
        </plugin>
    </plugins>

Cheers,
Jay

The Jetty issue workaround has been added to vaadin-archetype-sample version 1.0.5, where the dependencies on Vaadin and GWT versions were also updated (http://dev.vaadin.com/ticket/3694).

The typo in the archetype name in http://dev.vaadin.com/wiki/Articles/MavenIntegration has been corrected.

Hello all,

I’m having troubles trying to compile a custom widget with Maven 2 using gwt-maven-plugin (version 1.2) and vaadin-maven-plugin (version 1.0.0).

I configured my maven project just as it says on section “Adding widgetset compilation to an existing Vaadin project” of
MavenIntegration
and after execute the command mvn clean install everything looks fine except for the following messages:

[INFO]
 [gwt:resources {execution: default}]

[INFO]
 auto discovered modules [com.example.widgetset.MyWidgetSet]

[INFO]
 1 source files copied from GWT module com.example.widgetset.MyWidgetSet
[INFO]
 [compiler:compile]

[INFO]
 Compiling 160 source files to /Users/me/example/workspace/my-project/target/classes
[INFO]
 [gwt:compile {execution: default}]

[INFO]
 using GWT jars from project dependencies : 1.7.0
[INFO]
 auto discovered modules [com.example.widgetset.MyWidgetSet]

[INFO]
 establishing classpath list (scope = compile)
[INFO]
 com.example.widgetset.MyWidgetSet is up to date. GWT compilation skipped
[INFO]
 [vaadin:update-widgetset {execution: default}]

[INFO]
 auto discovered modules [com.example.widgetset.MyWidgetSet]

[INFO]
 Updating widgetset com.example.widgetset.MyWidgetSet
[INFO]
 establishing classpath list (scope = compile)
[ERROR]
 Feb 11, 2010 6:51:08 PM com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getAvailableWidgetSets
[ERROR]
 INFO: Widgetsets found from classpath:
[ERROR]
 	com.vaadin.terminal.gwt.DefaultWidgetSet in jar:file:/Users/me/.m2/repository/com/vaadin/vaadin/6.2.2/vaadin-6.2.2.jar!/
[ERROR]
 	com.example.widgetset.MyWidgetSet in file:/Users/me/example/workspace/my-project/src/main/java
[ERROR]

After that, the build is successful but the gwt compiler did not compile my custom widget. The VAADIN/widgetsets folder was created under the target/artifactId-version folder but it is empty, no widget in there.

Any idea or suggestion?

I believe you might have have run into one of two Maven GWT plugin bugs:
MGWT-147
or
MGWT-148
.

You could try the gwt-maven-plugin version 1.3 (or a snapshot) in which both should be fixed.

Thank you very much Henri!!!

I never thought that the last stable release (gwt-maven-plugin 1.2) was completely useless. I think this should be reported in the wiki article “MavenIntegration” don’t you think?

Thanks again.

I have another question:

I inherited my widgetset from com.vaadin.terminal.gwt.DefaultWidgetSet and at the moment of building the project with maven, all the default components were included successfully but I noticed that the default themes were not created on VAADIN/themes.

Is there something missing here or the vaadin-maven-plugin doesn’t consider the themes and I have to do that manually?

One more time thank you!!!

In basic development use, you don’t need copies of the standard themes in VAADIN/themes - they can be served by the Vaadin ApplicationServlet directly from the JAR as long as you have the correct servlet mapping for /VAADIN in your web.xml . In fact, it is usually better not to copy in development environments them unless you need them so that you would not run into mismatching theme versions when upgrading Vaadin. Your own themes should, of course, reside in VAADIN/themes.

In production environments, on the other hand, it does make sense to copy also the basic themes out of the JAR and have the web server serve them statically for improved performance.

Hi, I cant get this archetype to work. I get:

Requested resource [VAADIN/widgetsets/com.skillkash.ge.gm.gwt.ColorPickerWidgetSet/com.skillkash.ge.gm.gwt.ColorPickerWidgetSet.nocache.js]
not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.

Steps to recreate:

  1. have the latest eclipse helios with m2eclipse plugin.
  2. file->new->other->Maven Project-
  3. chose vaadin-archetype-sample
  4. project loads up in eclipse
  5. run as->Maven package
  6. Project properties->Server assign my local tomcat 6 server.
  7. run as-> run on server.
  8. tomcat loads up, and a webpage loads up in clipse with a spinning graphic in the center, and a message pops up:

Requested resource [VAADIN/widgetsets/com.skillkash.ge.gm.gwt.ColorPickerWidgetSet/com.skillkash.ge.gm.gwt.ColorPickerWidgetSet.nocache.js]
not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.

Any documentation on how to get this sample working?

Anyone know where I might find a widgetset and/or theme, and how I can add it to the pom.xml as a dependency?

Is ther eany documentation for how to run these sample apps, e.g. what maven targets are supplied?

As mentioned in a previous post, the GWT compiler Maven plugin had some bugs, and the archetype still used an old version of that plugin.

You could try the latest (1.3.0) version of the archetype, which uses the correct version of the plugin.
At least running “mvn clean package” should then also compile the widgetset correctly. I’m not sure if m2eclipse does this automatically when you select “Run on server” - if it does not seem to work, try Run As → “Maven package” first. If you have problems with this approach, you could also try to see if “mvn clean package jetty:run” works in your environment.

These are somehow listed on
the wiki page
, but the page should be updated with more current information.

Briefly:


  • vaadin:update-widgetset
    updates the widgetset definition if you have added add-ons with client side components to the project

  • jetty:run
    launches an embedded Jetty for testing your servlet

  • gwt:run
    launches the GWT development mode shell for debugging of client side code - note that you also need to change the POM to enable remote debugging, and run the server (e.g. jetty:run) in a separate process

  • gwt:clean
    and
    gwt:compile
    should be run automatically with the current plugin when you change the widgetset definition or client side code - you should not need to call them explicitly anymore

Does anyone else get this error:

[INFO]
 The plugin 'org.apache.maven.plugins:maven-vaadin-plugin' does not exist
or no valid version could be found

The plugin is right there in the m2 directory:

\.m2\repository\com\vaadin\vaadin-maven-plugin\1.0.0

I have no idea what’s going on … :mellow:

Maven seems to be looking for the Vaadin plugin under org.apache.maven.plugins . Check that you are using the groupId com.vaadin for the plugin in your pom.xml .

Well spotted, i should have seen that.

I spent a lot of time the last couple of days trying to get VisualizationsForVaadin to work and i now i finally get it to run update-widgetset without errors. In case someone else is facing the same problems, this is the error i was getting:

[ERROR]
 Exception in thread "main" java.io.IOException: The system cannot find the path specified
[ERROR]
         at java.io.WinNTFileSystem.createFileExclusively(Native Method)
[ERROR]
         at java.io.File.createNewFile(File.java:883)
[ERROR]
         at com.vaadin.terminal.gwt.widgetsetutils.WidgetSetBuilder.updateWidgetSet(WidgetSetBuilder.java:75)
[ERROR]
         at com.vaadin.terminal.gwt.widgetsetutils.WidgetSetBuilder.main(WidgetSetBuilder.java:51)

And the solution is to get the new version of Vaadin. The versions i use now without errors:
Vaadin: 6.4.0
VisualizationsForVaadin: 0.0.5
gwt-user: 2.0.4
gwt-visualization: 1.1.0
vaadin-maven-plugin: 1.0.0
WTP: 2.0
gwt-maven-plugin: 1.3-SNAPSHOT
Java 1.6, tomcat 6 and eclipse Galileo

Having said that - all install does is make an empty gwt folder in my target directory. I still dont have VisualizationsForVaadin running. :frowning:

Did you try running
gwt.compile
explicitly? Does that make any difference? Any messages about widgetset compilation?

Sorry to prolong the agony but I’m sort of new to Vaadin/Maven (I’m revisiting Maven after several years).

I’ve just ran the ‘mvn jetty:run’ command against Vaadin’s clean project archetype:

and Maven (2.2.0, OS X 10.6.4, JDK 1.6.0_20) is complaining about:

which is true as

no

‘SNAPHOT’ folder is created in the ‘target’ output folder.

I visited my pom.xml file, Vaadin is version 6.4.0, the Vaadin archetype
“1.0.5 resourceAsCSV” fix



is


in place, I tried/clutched at ’
mvn gwt:compile
’ but nothing.

Please help, as I’m proposing this technology to my boss at work, and in it’s current state, Maven build errors are not going to sell him the idea of either Maven or Vaadin (I

NEED

to develop with cool bits of technology to remain sane :grin: )

Cheers

Richard

P.S. I tried this with both the clean and sample Maven archetypes.
[u]

[/u][i]

[/i]

Hey, we like to bring solutions sometimes, not just problems :wink:

  1. I upgraded to Maven 2.2.1 (May not be necessary)
  2. After generating/downloading the Vaadin sample archetype, I did a ‘mvn clean package’ as suggested. This built the missing ‘widgetset’ (nb, ‘mvn gwt:compile’ did
    NOT
    do this).
  3. finally, I ran ‘mvn jetty:run’, and was greeted by a colour chart at http://localhost:8080/<my_vaadin_project_artifact_name>
  4. That’s it!

Cheers

Rich

I got the add-on working easily without maven and with the eclipse-vaadin plugin, and i can see now where it goes wrong with maven. This is what i found:

Calling gwt-maven-plugin:compile will compile the widgetset, but the result will be in the wrong location. Actually it will be in 2 wrong locations. As far as i can tell the widgetset stuff is supposed to end up in the VAADIN/widgetsets directory which should be directly adjecant to WEB-INF and META-INF.

In the maven project the 0E0E544EC6599E266957ECAC00238233.cache.html files end up in their own directory, like so:
\META-INF
\myproject.gwt.VisualisationsForVaadin (all the blabla.cache.html files)
\VAADIN (the themes are here but the widgetset not)
\WEB-INF

The rest of the VisualisationsForVaadin widgetset stuff is written to an ‘extra’ folder directly in the build directory, outside of, and on the same level as the project’s build. The resulting target directory looks like:
\extra
…\myproject.gwt.VisualisationsForVaadin
…\ rpcPolicyManifest
…\ soycReport
…\symbolMaps
\myproject
…\META-INF
…\myproject.gwt.VisualisationsForVaadin
…\VAADIN
…\WEB-INF
\

Hi. I’m trying to upgrade to Vaadin 6.5.4 with Maven 2 integration, to do that I’m using the maven plugins:

groupId:
org.codehaus.mojo

artifactId:
gwt-maven-plugin

version:
2.1.0-1

groupId:
com.vaadin

artifactId:
vaadin-maven-plugin

version:
1.0.1

And I’m importing the 2.1.1
gwt-user
version.

The problem is when I build my project with maven, because the console indicates everything is fine, but some maven plugin is not finding the DefaultWidgetset of Vaadin, and for that reason my package does not contain the default widgets; causing my application to display empty portlets.

I noticed too that on my MyWidgetSet.gwt.xml file, the plugin removes the line:

<inherits name="com.vaadin.terminal.gwt.DefaultWidgetSet" />

but i’m importing two other addons which are defined on MyWidgetSet.gwt.xml file explicitly, and those are found by maven when compiling, but not the DefaultWidgetset of Vaadin:


[INFO]
 [gwt:compile {execution: default}]

[INFO]
 auto discovered modules [com.example.widgetset.MyWidgetSet]

[INFO]
 Compiling module com.example.widgetset.MyWidgetSet
[INFO]
    Scanning for additional dependencies:  /.m2/repository/com/vaadin/vaadin/6.5.4.1/vaadin-6.5.4.1.jar!/com/vaadin/terminal/gwt/client/WidgetSet.java
[INFO]
       Computing all possible rebind results for 'com.vaadin.terminal.gwt.client.WidgetMap'
[INFO]
          Rebinding com.vaadin.terminal.gwt.client.WidgetMap
[INFO]
             Invoking generator com.vaadin.terminal.gwt.widgetsetutils.EagerWidgetMapGenerator
[INFO]
                Detecting Vaadin components in classpath to generate WidgetMapImpl.java ...
[ERROR]
 31/03/2011 06:10:31 PM com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getPaintablesHavingWidgetAnnotation
[ERROR]
 INFO: Searching for paintables..
[ERROR]
 [INFO]
                Widget set will contain implementations for following components:
[INFO]
                  org.vaadin.addthis.AddThis
31/03/2011 06:10:32 PM com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getPaintablesHavingWidgetAnnotation
[INFO]
                  org.vaadin.hene.popupbutton.PopupButton
[ERROR]
 INFO: Search took 1648ms
[INFO]
                Done. (2seconds)
[INFO]
    Compiling 5 permutations
[INFO]
       Compiling permutation 2...
[INFO]
       Process output
[INFO]
          Compiling
[INFO]
             Compiling permutation 3...
[INFO]
       Process output
[INFO]
          Compiling
[INFO]
             Compiling permutation 4...
[INFO]
       Process output
[INFO]
          Compiling
[INFO]
             Compiling permutation 1...
[INFO]
       Process output
[INFO]
          Compiling
[INFO]
             Compiling permutation 0...
[INFO]
    Compile of permutations succeeded

So anyone have some idea what’s happening, or what i’m setting wrong on my config? I will appreciate any ideas or comment about that.

Obviously the DefaultWidgetSet is not found when scanning the classpath, including JARs on the classpath that have the Vaadin widgetset related fields in their manifests etc.

Did you check whether your Vaadin JAR (in your Maven local repository - see the path above) contains the default widgetset or not? Is its manifest correct, and the first entry in the JAR? It certainly should, at least if it is the standard JAR, but I wonder about the 6.5.4.1 as the version number - the published version in Maven Central has the version number 6.5.4.

I also assume you have copied the configuration of the plugins you mentioned e.g. from a new version of one of the standard archetypes.

Also check the scope of your dependency to the Vaadin JAR - although I don’t think it would be the cause here.

Hi All,

I could not get to run Vaadin with Maven as suggested both on book of Vaadin and wiki (https://vaadin.com/wiki/-/wiki/Main/Using%20Vaadin%20with%20Maven)


[INFO]
 Archetype repository missing. Using the one from [com.vaadin:vaadin-archetype-clean:1.6.1]
 found in catalog remote
[INFO]
 ------------------------------------------------------------------------
[ERROR]
 BUILD FAILURE
[INFO]
 ------------------------------------------------------------------------
[INFO]
 : org.apache.maven.archetype.exception.UnknownArchetype: The desired archetype does not exist (com.vaadin:vaadin-archetype-clean:LATEST)
The desired archetype does not exist (com.vaadin:vaadin-archetype-clean:LATEST)
[INFO]
 ------------------------------------------------------------------------

After some googling around and a few hours later I reached the conclusion that Maven central is not used for archetype repository anymore.

So I had to add " -DarchetypeRepository=http://repo1.maven.org/maven2 " to get it working.