In order to save time compiling, I'm trying to break out the compilation of the widgetsets to a TeamCity build project of its own, we're using nexus as repo. The Vaadin "base project" is then to contain a dependency to the widgetset artifact to fetch the current version. I'm sure this has been done before.
The widgetset project builds fine in TeamCity. The jars and poms are correctly uploaded to nexus. I have unpacked the jars to make sure everything was in its place. So far so good.
In eclipse, the base project does fetch the widgetset artifact and contain it in its library. Seems good.
However, when I do a "mvn clean package" on the base project from eclipse and run it on Tomcat, I get the following error in the web browser:
Failed to load the widgetset: ./VAADIN/widgetsets/com.example.somerandomapp.web.AppWidgetSet/com.example.somerandomapp.web.AppWidgetSet.nocache.js?1376642850734
When I check the project structure, I find no VAADIN/widgetset-folder under the target folder. Additionally, in the maven dependency jar-file, there are one VAADIN folder containing gwt-unitCache and one VAADIN.widgetsets-folder containing the widgetset-goodies, as well as the - in the error message above - mentioned file.
I cannot get my head around this. I'm no maven pro, so I may have missed something trivial there. Also I'm no Vaadin pro, so I might as well have missed something just as trivial there.
I really hope there is someone out there that could help me get this ship in the water. I would greatly appreciate it!
Vaadin version: 7.1.1
Maven version: 3.0.4
My base project's pom.xml (leaving out some stuff for brevity):
<dependencies>
<!-- Some Random App - Commons -->
<dependency>
<groupId>com.example.somerandomapp.common</groupId>
<artifactId>somerandomapp-common-widgetset</artifactId>
<version>0.0.5-SNAPSHOT</version>
</dependency>
<!-- Vaadin -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<version>${vaadin.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${javax-servlet-api.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
My widgetset-pom (leaving out some stuff for brevity):
<!-- same Vaadin-plugins as in the "base project" -->
<!-- maven compiler, release, javadoc, deploy and source artifacts -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven-clean-plugin.version}</version>
<configuration>
<filesets>
<fileset>
<directory>src/main/webapp/VAADIN/widgetsets</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<excludes>
<exclude>VAADIN/widgetsets/WEB-INF/**</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin-plugin.version}</version>
<configuration>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
<!-- <runTarget>mobilemail</runTarget> -->
<!-- We are doing "inplace" but into subdir VAADIN/widgetsets. This
way compatible with Vaadin eclipse plugin. -->
<webappDirectory>${project.build.outputDirectory}/VAADIN/widgetsets</webappDirectory>
<hostedWebapp>${project.build.outputDirectory}/VAADIN/widgetsets</hostedWebapp>
<noServer>true</noServer>
<!-- Remove draftCompile when project is ready -->
<draftCompile>false</draftCompile>
<compileReport>true</compileReport>
<style>OBF</style>
<strict>true</strict>
<runTarget>http://localhost:8080/</runTarget>
</configuration>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>resources</goal>
<goal>update-theme</goal>
<goal>update-widgetset</goal>
<goal>compile-theme</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<versionRange>[7.1.1,)</versionRange>
<goals>
<goal>update-theme</goal>
<goal>resources</goal>
<goal>compile-theme</goal>
<goal>update-widgetset</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Update:
I have setup my MainUI class like this:
@WebServlet(value = {"/foo/*", "/VAADIN/*"} , asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = MainUI.class, widgetset = "com.example.somerandomapp.common.widgetset.AppWidgetSet")
I realised this has something to do with it and changed it to the correct widgetset. But I still get the same error:
Failed to load the widgetset: ./VAADIN/widgetsets/com.example.somerandomapp.common.widgetset.AppWidgetSet/com.example.somerandomapp.common.widgetset.AppWidgetSet.nocache.js?1376662202437
Now, this error shows the correct path to the nocache-file in the classpath, which makes me very confused, because the file is there, in the lib folder.
I hope this didn't confuse you further....
Update 2:
Actually this is adequate:
@WebServlet(value = "/*", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = MainUI.class, widgetset = "com.example.somerandomapp.common.widgetset.AppWidgetSet")