Jenkins - 构建Vaadin Web应用程序需要永远

时间:2014-11-01 18:36:10

标签: java maven jenkins continuous-integration vaadin

我的目标是建立持续集成(IntelliJ IDEA - > github - > jenkins - > tomcat),但“Build Vaadin Web Application”流程不会结束(见下文)。这个过程是从我的maven构建中隐式调用的,只有在我杀死服务器时才会结束(顺便说一句:服务器的限制为500mb ram)。

Endless Build

jenkins的maven目标是“干净的包裹”。 war文件将通过另一个jenkins插件部署,但jenkins甚至没有达到那么远。

我的pom的构建部分看起来如下(它来自原型,我还没有真正理解这部分):

<build>
        <plugins>
            <!--vaadin-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <!-- As we are doing "inplace" GWT compilation, ensure the widgetset -->
            <!-- directory is cleaned properly -->
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>src/main/webapp/VAADIN/widgetsets</directory>
                        </fileset>
                    </filesets>
                </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>${basedir}/src/main/webapp/VAADIN/widgetsets
                    </webappDirectory>
                    <hostedWebapp>${basedir}/src/main/webapp/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>
                        <configuration>
                            <!-- if you don't specify any modules, the plugin will find them -->
                            <!-- <modules> <module>com.vaadin.demo.mobilemail.gwt.ColorPickerWidgetSet</module>
                                </modules> -->
                        </configuration>
                        <goals>
                            <goal>resources</goal>
                            <goal>update-widgetset</goal>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!--<plugin>-->
                <!--<groupId>org.mortbay.jetty</groupId>-->
                <!--<artifactId>jetty-maven-plugin</artifactId>-->
            <!--</plugin>-->
            <!--vaadin end-->
        </plugins>
        <pluginManagement>
            <plugins>
                <!--vaadin-->
                <!--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.0.0.beta3,)
                                        </versionRange>
                                        <goals>
                                            <goal>resources</goal>
                                            <goal>update-widgetset</goal>
                                            <goal>compile</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
                <!--vaadin end-->
            </plugins>
        </pluginManagement>
    </build>

自动生成的AppWidgetSet如下所示:

<module>
    <inherits name="com.vaadin.DefaultWidgetSet"/>
</module>

web.xml如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         id="WebApp_ID" version="2.5">
    <display-name>Vaadin Web Application</display-name>
    <context-param>
        <description>Vaadin production mode</description>
        <param-name>productionMode</param-name>
        <param-value>false</param-value>
    </context-param>
    <servlet>
        <servlet-name>Vaadin Application Servlet</servlet-name>
        <servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
        <init-param>
            <description>Vaadin UI to display</description>
            <param-name>UI</param-name>
            <param-value>de.bahr.dhbw.logframe.UI.NavigatorUI</param-value>
        </init-param>
        <init-param>
            <description>Application widgetset</description>
            <param-name>widgetset</param-name>
            <param-value>de.bahr.dhbw.logframe.AppWidgetSet</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>Vaadin Application Servlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
</web-app>

是否有任何关于将Vaadin与Jenkins一起使用的指南?你能帮助我让这个设置运行吗?提前谢谢!

(也在https://vaadin.com/forum#!/thread/8523481询问。)

1 个答案:

答案 0 :(得分:1)

正如Thorbjørn指出的那样,问题是服务器的容量造成的。

第一个服务器ram限制为512 MB,没有交换空间(主机最初不提供交换)。增加交换空间会产生相同的结果。因此,我选择了另一台带有1 gb ram并且没有交换的服务器。在那种情况下,我遇到了“maven失败状态137”,告诉我(通过谷歌)使用交换。

这样做了:至少1 gb ram和一些交换(在我的情况下是4 gb)。 vaadin widgetsets的编译看起来很重。