Wednesday, 7 April 2010

Vaadin addons and maven and eclipse.

Afters struggling for almost 3 days, I finally got some vaadin add-ons working for me.
No matter what I did, I could not get maven to compile the custom widget sets :'-(

Wanting to do it with maven I started off with the instructions at http://dev.vaadin.com/wiki/Articles/MavenIntegration.

I got error messages like:
Failed to load the widgetset: 
/my-project/VAADIN/widgetsets/my.company.my.project.widgetset.My_ProjectWidgetset/
my.company.my.project.widgetset.My_ProjectWidgetset.nocache.js?1270654337749

Building it with the eclipse plugin said:
Compiling widgetset my.company.my.project.widgetset.My_ProjectWidgetset
Updating GWT module description file...
07 Apr 2010 5:46:09 PM com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getAvailableWidgetSets
INFO: Widgetsets found from classpath:
com.vaadin.terminal.gwt.DefaultWidgetSet in jar:file:/stf/opt/maven/repository/com/vaadin/vaadin/6.2.6/vaadin-6.2.6.jar!/
my.company.my.project.widgetset.My_ProjectWidgetset in file:/stf/prj/My_Project/src/main/resources

Done.
Starting GWT compiler
Widgetset compilation completed

But when running the webapp, I got:
Widgetset does not contain implementation for org.vaadin.browsercookies.BrowserCookies. Check its @ClientWidget mapping, widgetsets GWT module descrioption file and re-compile your widgetset. Unrendered UIDL:

org.vaadin.browsercookies.BrowserCookies(NO CLIENT IMPLEMENTATION FOUND) id=PID7

variables
Widgetset does not contain implementation for com.github.wolfie.meteorcursor.MeteorCursor. Check its @ClientWidget mapping, widgetsets GWT module descrioption file and re-compile your widgetset. Unrendered UIDL:

com.github.wolfie.meteorcursor.MeteorCursor(NO CLIENT IMPLEMENTATION FOUND) id=PID8 gr=75 th=10 pl=1000 di=2 im=theme://images/logo.png fr=0 disabled=false

I thought that it was building, since the addons that I wanted to use got detected.
Little did I know that it was not actually building!
Building with maven said:
[INFO] Updating widgetset my.company.my.project.widgetset.My_ProjectWidgetset
[INFO] establishing classpath list (scope = compile)
[ERROR] 07 Apr 2010 5:38:31 PM com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getAvailableWidgetSets
[ERROR] INFO: Widgetsets found from classpath:
[ERROR] com.github.wolfie.meteorcursor.MeteorcursorWidgetset in jar:file:/stf/opt/maven/repository/com/github/wolfie/meteorcursor/1.0.0/meteorcursor-1.0.0.jar!/
[ERROR] org.vaadin.browsercookies.widgetset.BrowserCookiesApplicationWidgetset in jar:file:/stf/opt/maven/repository/com/vaadin/sami/browsercookies/1.0.2/browsercookies-1.0.2.jar!/
[ERROR] com.vaadin.terminal.gwt.DefaultWidgetSet in jar:file:/stf/opt/maven/repository/com/vaadin/vaadin/6.2.6/vaadin-6.2.6.jar!/
[ERROR] my.company.my.project.widgetset.My_ProjectWidgetset in file:/stf/prj/My_Project/src/main/resources
[ERROR]


The reason it was not building was because I was trying to use the stable version of the gwt-maven-plugin: 1.2
After reading this forum post again, I tried 1.3-SNAPSHOT of this plugin; and all my troubles went away.


So now I build it with maven, and it should give output like this:
[INFO] [gwt:compile {execution: default}]                                                                                                                    
[INFO] using GWT jars from project dependencies : 1.7.1
[INFO] auto discovered modules [za.co.enerweb.ebr.gui.vaadin.widgetset.Ebr_vaadin_webWidgetset]
[INFO] establishing classpath list (scope = compile)
[INFO] establishing classpath list (scope = compile)
[INFO] establishing classpath list (scope = compile)
[INFO] establishing classpath list (scope = compile)
[INFO] establishing classpath list (scope = compile)
[INFO] establishing classpath list (scope = compile)
[INFO] Compiling module my.company.my.project.widgetset.My_ProjectWidgetset
[INFO] Scanning for additional dependencies: jar:file:/stf/opt/maven/repository/com/vaadin/vaadin/6.2.6/vaadin-6.2.6.jar!/com/vaadin/terminal/gwt/client/DefaultWidgetSet.java
[INFO] Computing all possible rebind results for 'com.vaadin.terminal.gwt.client.WidgetMap'
[INFO] Rebinding com.vaadin.terminal.gwt.client.WidgetMap
[INFO] Invoking
[INFO] Detecting Vaadin components in classpath to generate WidgetMapImpl.java ...
[INFO] Widget set will contain implementations for following components:
[INFO] com.github.wolfie.meteorcursor.MeteorCursor
[INFO] com.vaadin.ui.AbsoluteLayout
[INFO] com.vaadin.ui.Accordion
[INFO] com.vaadin.ui.Button
[INFO] com.vaadin.ui.CheckBox
[INFO] com.vaadin.ui.ComboBox
[INFO] com.vaadin.ui.CssLayout
[INFO] com.vaadin.ui.CustomComponent
[INFO] com.vaadin.ui.CustomLayout
[INFO] com.vaadin.ui.DateField
[INFO] com.vaadin.ui.Embedded
[INFO] com.vaadin.ui.Form
[INFO] com.vaadin.ui.FormLayout
[INFO] com.vaadin.ui.GridLayout
[INFO] com.vaadin.ui.HorizontalLayout
[INFO] com.vaadin.ui.Label
[INFO] com.vaadin.ui.Link
[INFO] com.vaadin.ui.ListSelect
[INFO] com.vaadin.ui.MenuBar
[INFO] com.vaadin.ui.NativeButton
[INFO] com.vaadin.ui.NativeSelect
[INFO] com.vaadin.ui.OptionGroup
[INFO] com.vaadin.ui.OrderedLayout
[INFO] com.vaadin.ui.Panel
[INFO] com.vaadin.ui.PopupView
[INFO] com.vaadin.ui.ProgressIndicator
[INFO] com.vaadin.ui.RichTextArea
[INFO] com.vaadin.ui.Select
[INFO] com.vaadin.ui.Slider
[INFO] com.vaadin.ui.SplitPanel
[INFO] com.vaadin.ui.TabSheet
[INFO] com.vaadin.ui.Table
[INFO] com.vaadin.ui.TextField
[INFO] com.vaadin.ui.Tree
[INFO] com.vaadin.ui.TwinColSelect
[INFO] com.vaadin.ui.Upload
[INFO] com.vaadin.ui.UriFragmentUtility
[INFO] com.vaadin.ui.VerticalLayout
[INFO] com.vaadin.ui.Window
[INFO] org.vaadin.browsercookies.BrowserCookies
[INFO] Done. (2seconds)
[INFO] Compiling 1 permutations
[INFO] Permutation compile succeeded
[INFO] Linking into /stf/prj/My_Project/src/main/webapp/VAADIN/widgetsets
[INFO] Link succeeded
[INFO] Compilation succeeded -- 40.785s


To be able to serve my webapp using tomcat launched from eclipse I need to compile the GWT stuff into src/main/webapp . So unlike the instructions I mention at the top of this post, some key parts of my pom is as follows:
  <properties>
<vaadin-widgets-dir>src/main/webapp/VAADIN/widgetsets</vaadin-widgets-dir>
</properties>
<build>
<plugins>
<!-- Compiles your custom GWT components with the GWT compiler -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.3-SNAPSHOT</version>
<executions>
<execution>
<configuration>
<webappDirectory>${vaadin-widgets-dir}</webappDirectory>
<extraJvmArgs> -Dgwt.style=PRETTY -Xmx512M -Xss1024k</extraJvmArgs>
</configuration>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Updates Vaadin 6.2 widgetset definitions based on project dependencies -->
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<goals>
<goal>update-widgetset</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<!-- also delete the generated vaadin web content -->
<directory>${vaadin-widgets-dir}</directory>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>

Thursday, 4 March 2010

vaadin 6.3 ant build target

The vaadin source web page still has out-dated build instructions.
I tried:
vaadin/6.3/build>$ ant package-linux                                                                                                         
Buildfile: build.xml

BUILD FAILED
Target "package-linux" does not exist in the project "Vaadin".

Total time: 0 seconds


Looking at the following I realised that things have changed a bit:
$ ant -p
Buildfile: build.xml

Main targets:

build Build package required files, without packing them.
compile-widgetset Compiles the widgetset given as the first parameter
package-all Build public packages.
package-jar Create vaadin-x.y.z.jar file.
package-jar-quick Create vaadin-x.y.z.jar file quick.
test-build used for testing build.xml
test-package used for testing build.xml
Default target: package-all

So I tried the following starting building like crazy:
$ ant package-all                                                      
Buildfile: build.xml
...

But it got stuck on:

manual-checkout:
[echo] Checking out manual from repository http://dev.vaadin.com/svn/doc/trunk
[mkdir] Created dir: /stf/prj/fs/vaadin/6.3/build/checkout

Finally I did:
$ ant package-jar

and the jar finally got built!

BUILD SUCCESSFUL
Total time: 10 minutes 49 seconds


Will try out package-jar-quick next...

This made me shout out complaints about ant (ask my co-workers) and fall in love with maven all over again.

Tuesday, 2 March 2010

How to make Archiva less paranoid about passwords

After just 3 login attempts a user's account is locked by Archiva, which is quite bad if a whole team and continuous integration servers uses the same account.

I think you should just add an exponentially growing timeout to when the user can log in (maybe per source ip) or at least make it configurable from the frontend. But anyways, for our internal/firewalled archiva this sort of thing is a bit of over kill.

I finally found out how to convince it to be more lenient.
Just add the following content:
security.policy.password.expiration.days=999999
security.policy.password.expiration.enabled=false
security.policy.allowed.login.attempt=300
security.policy.password.previous.count=1
security.policy.password.rule.reuse.enabled=false


to the equivalent file to your system:
glassfish_2.1/domains/archiva/lib/classes/org/apache/maven/archiva/security.properties


http://osdir.com/ml/users-archiva-apache/2009-02/msg00031.html