为了节省编译时间,我试图将小部件集的编译分解为它自己的 TeamCity 构建项目,我们使用 nexus 作为 repo。Vaadin“基础项目”将包含对 widgetset 工件的依赖项以获取当前版本。我敢肯定这以前已经做过了。
widgetset 项目在 TeamCity 中构建良好。jar 和 pom 已正确上传到 nexus。我已经打开了罐子的包装,以确保一切都在原位。到现在为止还挺好。
在 Eclipse 中,基础项目确实获取了小部件集工件并将其包含在其库中。看起来不错。
但是,当我从 eclipse 对基础项目执行“mvn clean package”并在 Tomcat 上运行它时,我在 Web 浏览器中收到以下错误:
Failed to load the widgetset: ./VAADIN/widgetsets/com.example.somerandomapp.web.AppWidgetSet/com.example.somerandomapp.web.AppWidgetSet.nocache.js?1376642850734
当我检查项目结构时,我发现目标文件夹下没有 VAADIN/widgetset-folder。此外,在 maven 依赖 jar 文件中,有一个包含 gwt-unitCache 的 VAADIN 文件夹和一个包含 widgetset-goodies 的 VAADIN.widgetsets-folder,以及上述错误消息中提到的文件。
我无法理解这一点。我不是专家,所以我可能错过了一些琐碎的事情。我也不是 Vaadin 专业人士,所以我可能错过了一些同样微不足道的事情。
我真的希望有人能帮我把这艘船弄到水里。我将不胜感激!
Vaadin 版本:7.1.1 Maven 版本:3.0.4
我的基础项目的 pom.xml (为简洁起见省略了一些内容):
<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>
我的 widgetset-pom(为简洁起见省略了一些东西):
<!-- 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>
更新: 我已经像这样设置了我的 MainUI 类:
@WebServlet(value = {"/foo/*", "/VAADIN/*"} , asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = MainUI.class, widgetset = "com.example.somerandomapp.common.widgetset.AppWidgetSet")
我意识到这与它有关,并将其更改为正确的小部件集。但我仍然得到同样的错误:
Failed to load the widgetset: ./VAADIN/widgetsets/com.example.somerandomapp.common.widgetset.AppWidgetSet/com.example.somerandomapp.common.widgetset.AppWidgetSet.nocache.js?1376662202437
现在,这个错误在类路径中显示了 nocache-file 的正确路径,这让我很困惑,因为该文件在 lib 文件夹中。我希望这不会让你更困惑......
更新 2: 实际上这已经足够了:
@WebServlet(value = "/*", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = MainUI.class, widgetset = "com.example.somerandomapp.common.widgetset.AppWidgetSet")