有什么方法可以触发Maven Appengine Devserver自动刷新静态文件吗? [英] Is there any way to trigger the Maven Appengine Devserver to auto-refresh static files?

查看:80
本文介绍了有什么方法可以触发Maven Appengine Devserver自动刷新静态文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最新版本的maven插件启用了每5秒更新一次代码的功能,这是一个很大的改进.但是,除非我配置错误,否则似乎不会拾取静态文件更改,例如正在进行的Javascript连接到appengine代码.
有什么办法可以改变这种行为,还是我只需要等待一个新版本?

The most recent version of the maven plugin has enabled updating of code every 5s, which is a great improvement. But unless I am configuring this wrong, it doesn't seem to pick up static file changes such as work in progress Javascript connecting to the appengine code.
Is there any way to alter this behavior or do I just need to wait for a new release?

推荐答案

到目前为止,我发现的最佳方法是在pom.xml中配置以下条目.这将自动生成您的静态文件并反映在页面上.

So far, best way i found was configuring below entries in pom.xml. This will build automatically your static files and reflects on the page.

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.7</version>
            <executions>
                <execution>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target>
                            <property name="target.webapp.dir"
                                value="${project.build.directory}/${project.build.finalName}" />
                            <property name="src.webapp.dir" value="${basedir}/src/main/webapp" />

                            <sync verbose="true" todir="${target.webapp.dir}"
                                includeEmptyDirs="true">
                                <fileset dir="${src.webapp.dir}" />
                                <preserveintarget>
                                    <include name="WEB-INF/lib/**" />
                                    <include name="WEB-INF/classes/**" />
                                    <include name="WEB-INF/appengine-generated/**" />
                                </preserveintarget>
                            </sync>

                            <!-- <sync verbose="true" todir="${target.webapp.dir}/WEB-INF/classes"> 
                                <fileset dir="${basedir}/target/classes" /> </sync> -->

                        </target>
                    </configuration>
                </execution>
            </executions>
        </plugin>

以及

<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>org.apache.maven.plugins</groupId>
                                    <artifactId>maven-antrun-plugin</artifactId>
                                    <versionRange>[1.6,)</versionRange>
                                    <goals>
                                        <goal>run</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute>
                                        <runOnIncremental>true</runOnIncremental>
                                    </execute>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>

这很好.更改并保存任何静态文件后,该文件就会立即反映在页面上.

This is working fine. As soon as any static files changed and saved, it got reflected on the page.

这篇关于有什么方法可以触发Maven Appengine Devserver自动刷新静态文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆