Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Stepper with maven

Benny Hjertaas
1 decade ago Apr 22, 2010 9:17am

I've unsuccessfully tried to add this add-on to an existing Vaading project using maven.
Does this add-on have the correct structure to be added in such a way?

There are many threads in the forum regarding maven add-on/widgetset problems. Is there a step-by-step procedure I can follow?

Benny Hjertaas
1 decade ago Apr 27, 2010 5:09pm

Here is how to use add-ons with maven in 10 steps. The steps below are untested, so please reply to the thread if I missed something.

1) download add-on jar

2) Using command line go to the directory where the jar file is located

3) Assuming that you just wanna store the dependency on your local repository you can run something like

mvn install:install-file -Dfile=nameOfAddOn-1.0.jar -DgroupId=org.your.group -DartifactId=someArtifactId -Dpackaging=jar -Dversion=1.0

4) Somewhere under src/main/java directory in your project add a GWT module descriptor file
For example make a package called org.your.group.gwt and then in there make a SomethingWidgetSet.gwt.xml

In this file add something like the following

<module>
 <!--
 This file is automatically updated based on new dependencies by the
 goal "vaadin:update-widgetset".

 Running the goals "gwt:clean gwt:compile" may be required to compile
 the widgetset until http://jira.codehaus.org/browse/MGWT-148 is
 resolved. 
 -->

 <!--
 This is needed because of a bug in gwt-maven-plugin 1.2
 (http://jira.codehaus.org/browse/MGWT-147):
 modules without entry points are never compiled.
 -->
 <entry-point class="com.vaadin.terminal.gwt.client.DefaultWidgetSet" />

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

 <!-- WidgetSet default theme --> 
 <!-- <stylesheet src="colorpicker/styles.css"/> -->

</module>

5) In the web.xml file for your project, something like the following should be present (this might not be strictly necessary, but doesn't hurt either)

<servlet>
 <servlet-name>Vaadin Application Servlet</servlet-name>
 <servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
 <init-param>
 <param-name>widgetset</param-name>
 <param-value>org.your.group.gwt.SomethingWidgetSet</param-value>
 </init-param>
 </servlet>

6) If you made your project with the vaadin-archetype-sample, your pom file is more or less ready.
If you made your project with vaadin-archetype-clean then you have to uncomment the commented code.

It is probably a good idea to change vaadin dependency to 6.3 (it defaults to 6.2 at time of writing)
and gwt-user to 2.0.3 (it defaults to 1.7.1 at time of writing).

7) Also add a dependency to the addOn that we mavenized in step 3
Something like

<dependency>
 <groupId>org.your.group</groupId>
 <artifactId>someArtifactId</artifactId>
 <version>1.0</version>
 </dependency>

8) Now if you run a mvn clean vaadin:update-widgetset or even a mvn clean install
it should detect your addOn/widgetset and compile it.

If you see something like

[ERROR] Apr 27, 2010 7:01:03 PM com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getAvailableWidgetSets
[ERROR] INFO: Widgetsets found from classpath:
[ERROR] org.vaadin.henrik.refresher.RefresherApplicationWidgetset in jar:file:/.m2/repository/vaadin/addon/refresher/1.0/refresher-1.0.jar!/
[ERROR] org.your.group.gwt.SomethingWidgetSet in file:/workspace/myproject/src/main/java
[ERROR] com.vaadin.terminal.gwt.DefaultWidgetSet in jar:file:/.m2/repository/com/vaadin/vaadin/6.3.0/vaadin-6.3.0.jar!/

It is not actually an error. Just maven getting confused when it is doing info statements

9) Refresh your SomethingWidgetSet file and notice that there is a new line of text at the bottom referring to the addOn

10) You should now be able to use the addOn in your java code

Henri Sara
1 decade ago Apr 28, 2010 9:54am

I did not test this procedure, but overall it looks correct to me.

Note that steps 4-6 are only needed the first time, not when adding other add-ons to a project after the first. Furthermore, steps 4-5 are already done in the vaadin-archetype-sample, although redoing them (perhaps just copying files) to change the name of the widgetset might be useful.

So when adding a second add-on to a project, the steps are something like:

a) download the add-on and run mvn install:install-file to install the add-on to your local repository
b) add a dependency to the add-on
c) mvn clean vaadin:update-widgetset
d) refresh the project and use the add-on

Artur Signell
1 decade ago Apr 29, 2010 2:27pm

Hi,

A new version (1.2.0) of the archetypes are out and they now default to Vaadin 6.3.1 and GWT 2.0.3.
I used the following process to verify that add-ons work with Maven and the new archetype:

1.

mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-widget -DarchetypeVersion=1.2.0 -DgroupId=mygroup -DartifactId=tst -Dversion=1.0

2. Download add-on e.g., playingcards-0.3.2.jar

3.

mvn install:install-file -Dfile=playingcards-0.3.2.jar -DgroupId=org.vaadin.artur -DartifactId=playingcards -Dpackaging=jar -Dversion=0.3.2

4. Add a dependency to the add-on to pom.xml:

<dependency>
	<groupId>org.vaadin.artur</groupId>
	<artifactId>playingcards</artifactId>
	<version>0.3.2</version>
</dependency>

5. Add test code to see it works. Edit the application.java and add:

Card c = new Card(Suite.CLUBS,12);
	window.addComponent(c);

6.

mvn vaadin:update-widgetset install

Sure hope we get Maven support for the Directory one day so you would get away with just adding the dependency to the pom.xml.

Richard Perfect
1 decade ago Jun 24, 2010 11:04pm
Benny Hjertaas
1 decade ago Jul 15, 2010 10:05am
Henri Sara
1 decade ago Jul 15, 2010 10:17am
Benny Hjertaas
1 decade ago Jul 15, 2010 11:41am
Benny Hjertaas
1 decade ago Jul 15, 2010 1:40pm
Henri Sara
1 decade ago Jul 16, 2010 7:21am
Benny Hjertaas
1 decade ago Aug 05, 2010 8:13am
Henri Sara
1 decade ago Aug 05, 2010 9:40am
Benny Hjertaas
1 decade ago Aug 05, 2010 11:01am
Benny Hjertaas
1 decade ago Aug 26, 2010 2:41pm
Henri Sara
1 decade ago Aug 30, 2010 8:49am
Manfred Schürhoff
1 decade ago Sep 23, 2010 12:56pm
Henri Sara
1 decade ago Sep 24, 2010 7:03am
Manfred Schürhoff
1 decade ago Sep 24, 2010 9:05am
Artur Signell
1 decade ago Oct 12, 2010 3:01pm
Manfred Schürhoff
1 decade ago Oct 13, 2010 6:40am
Manfred Schürhoff
1 decade ago Oct 13, 2010 7:36am
Dmitry Katsubo
1 decade ago Nov 23, 2010 11:56am
Henri Sara
1 decade ago Nov 23, 2010 12:33pm
Dmitry Katsubo
1 decade ago Nov 23, 2010 1:52pm
Henri Sara
1 decade ago Nov 23, 2010 2:44pm
Dmitry Katsubo
1 decade ago Nov 23, 2010 3:31pm
Henri Sara
1 decade ago Nov 24, 2010 6:48am
Dmitry Katsubo
1 decade ago Dec 16, 2010 6:11pm
Umesh Upadhyay
9 years ago Sep 26, 2012 5:15pm
Dmitry Katsubo
9 years ago Sep 27, 2012 7:33am
Nikolai Bochkarev
8 years ago Jun 10, 2013 10:44am
Henri Sara
8 years ago Jun 11, 2013 6:39am

Have you tried cleaning the project?
Has the JDK version on the computer been changed?

Most likely this is a classpath issue with two incompatible versions of some library on the classpath - probably GWT libraries and Tomcat.
You could try to add <gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath> to your GWT plugin configuration and see if it helps.

Nikolai Bochkarev
8 years ago Jun 11, 2013 10:34am