How to compile widgetsets in IntelliJ IDEA?

I have recently started wirh Vaadin development and also run into this “widgetset compile” thing.
I’m using IntelliJ Ultimate Edition. How can I recompile the widget set?
As I’m using IntelliJ Ultimate Edition I did not use maven for the project.

Hi,
As @Matti stated, if you’re using Maven, this is quite straightforward.
Make sure you have the vaadin-maven-plugin in place and configure it.
Then run “package” goal for the project and it should do the trick. This would be an example configuration that is working in one of my projects:

<plugin> <groupId>com.vaadin</groupId> <artifactId>vaadin-maven-plugin</artifactId> <version>${vaadin.plugin.version}</version> <configuration> <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs> <webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets</webappDirectory> <hostedWebapp>${basedir}/src/main/webapp/VAADIN/widgetsets</hostedWebapp> <noServer>true</noServer> <draftCompile>false</draftCompile> <style>OBF</style> <compileReport>true</compileReport> <runTarget>http://localhost:8080/</runTarget> </configuration> <executions> <execution> <configuration> </configuration> <goals> <goal>resources</goal> <goal>update-widgetset</goal> <goal>compile</goal> </goals> </execution> </executions> </plugin> Hope it helps
Cheers
Fran

Hi,

all experts that I know are using maven or gradle for their Vaadin projects, even though they have the Ultimate Edition. Was there some specific reason not to use Maven?

cheers,
matti

Hi,

I did not use Maven as I did not think I’d need it with the Ultimate Edition and, frankly, I don’t know it very well.
Do I have to convert my project to a Maven project or what?

Thank you,
Jiří

Hi Jiri,
I would not say that you
need
to convert it, but I would highly recommend it.
You should in general use sophisticated build tools that save you quite a lot of work.
Take into account that tools like Maven, not only provide the building capabilities, but also a proper library/dependency management that is VERY valuable nowadays. Don’t get scared because you’ll be quite rapidly working with the Maven essentials and you will never regret from having gone this way.
Cheers
Fran

HI,
I tried to have a go on using maven and Vaadin and I have to say that my experience is pretty bad so far.
Even the example given on Vaadin pages on how to create a Vaadin appplication doesn’t work (see below).
Yes, I may be doing something wrong, but to figure this stuff out I’d have to read tons of documentation and forum posts just to get my code to compile.

OTOH when using the IntelliJ builtin tools it just works. Except for the widget set compilation, that is.
I think that for now, I’ll just avoid using widget addons, so that I don’t have this problem.

Here is the maven error:

PS Y:\devel\projects\project2> mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=LATEST
[INFO]
 Scanning for projects...
[INFO]

[INFO]
 ------------------------------------------------------------------------
[INFO]
 Building project2 0.1
[INFO]
 ------------------------------------------------------------------------
[INFO]

[INFO]
 >>> maven-archetype-plugin:2.4:generate (default-cli) > generate-sources @ project2 >>>
[INFO]

[INFO]
 <<< maven-archetype-plugin:2.4:generate (default-cli) < generate-sources @ project2 <<<
[INFO]

[INFO]
 --- maven-archetype-plugin:2.4:generate (default-cli) @ project2 ---
[INFO]
 Generating project in Interactive mode
[WARNING]
 Archetype not found in any catalog. Falling back to central repository (http://repo.maven.apache.org/maven2).
[WARNING]
 Use -DarchetypeRepository=<your repository> if archetype's repository is elsewhere.
Downloading: http://repo.maven.apache.org/maven2/com/vaadin-archetype-application/maven-metadata.xml
[INFO]

[INFO]
 ------------------------------------------------------------------------
[INFO]
 Skipping project2
[INFO]
 This project has been banned from the build due to previous failures.
[INFO]
 ------------------------------------------------------------------------
[INFO]
 ------------------------------------------------------------------------
[INFO]
 BUILD FAILURE
[INFO]
 ------------------------------------------------------------------------
[INFO]
 Total time: 2.631 s
[INFO]
 Finished at: 2015-11-06T09:02:05+01:00
[INFO]
 Final Memory: 12M/28M
[INFO]
 ------------------------------------------------------------------------
[ERROR]
 Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:generate (default-cli) on project project2: The desired archetype does not exist (com:vaadin-archetype-application:LATEST) -> [Help 1]

[ERROR]

[ERROR]
 To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR]
 Re-run Maven using the -X switch to enable full debug logging.
[ERROR]

[ERROR]
 For more information about the errors and possible solutions, please read the following articles:
[ERROR]
 [Help 1]
 http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Hi,

Did you copy paste the command from here:
https://vaadin.com/maven/

Don’t know what happened, but by reading the log it seems your groupId was wrong (com vs com.vaadin). In windows you shoulnd’t copy past the command and ignore the backslashes (that only work in unix based machines). Alternatively you can use the interactive mode or probably the most easiest method, just use the UI by your IDE.

cheers,
matti

The problem was that I was using Power Shell. When I ran the same command in “normal” windows shell it worked.
I’ve now got to the point when I can build and deploy the app.
But when I try to run it I get the following error:

"Failed to load the widgetset: ./VAADIN/widgetsets/com.vaadin.DefaultWidgetSet/com.vaadin.DefaultWidgetSet.nocache.js?1447319560469

Could you help me with that?

Thank you,
Jiri

Ok, I can solve this by including vaadin-client-compiled, but then I’m back to square one with my “compile widgetset” problem. The gwt compiler runs and compiles widgetset for the add-on I use, but I cannot figure out how to use it.

Hi,

Did you add @Widgetset annotation to your UI class? To me it seems it is now still using the precompiled widgetset although you already compile the application speficic one.

I typically use just @Widgetset(“AppWidgetSet”) and place the widgetset file (AppWidgetSet.gwt.xml) to resource root (src/main/resources).

cheers,
matti

Yes, I was finally able to make it work.

Thanks,
Jiri

Hi Jiri,
Please could you tell me how did you fix that ?

I eventually found out, that I don’t need to use maven at all. One just needs to add GWT facet to the project specify the GWT module and it wil work automagically.

Okey I will try this ,thank you very much

Jiri no resulat :confused:

24901.png

I have
MyAppWidgetset.gwt.xml in classpath, which looks likes this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
<module>
<inherits name="org.vaadin.risto.stepper.widgetset.StepperWidgetset" />
<inherits name="org.vaadin.peter.contextmenu.ContextmenuWidgetset" />
<inherits name="com.vaadin.DefaultWidgetSet" />
</module>

Then I have
@Widgetset(“InvoicesWidgetset”)
annotation on my UI class.

Its working for me. Maybe I’m forgetting something, but it should work

Jiri Please how did you generate MyAppWidgetset.gwt.xml

Jiri Please how did you generate MyAppWidgetset.gwt.xml

Please add full support for IntelliJ. With plugin for vaadin and its compile widgetset like Eclipse.

What do you miss? The vaadin maven plugin is fully working with intellij and has everything you need. (see attachment)
26510.png

I miss the two icons like in Eclipse. Also general think they should 100% IntelliJ.