GWT Maven - webapp files getting deleted when running in dev mode

旧巷老猫 提交于 2020-01-02 07:13:54

问题


As specified in the gwt maven mojo plugin documentation, I have selected src/main/webapp folder as my war directory in eclipse->project properties->Google->Web application. Then, when I tried to run my gwt project in dev mode from eclipse, the html files in webapp folder was getting deleted. After some investigation, I was able to fix this by modifiying -war value in run configuration to the target folder of the project. But the problem I am facing now is that, after running the project in dev mode, I have to manually copy the html files to the target directory each time for the dev mode to work. Can anyone please help me to identify what I am missing here. How can I set the webapp folder as war directory and prevent the files from getting deleted? Please help.


回答1:


The correct way to configure the Google Plugin for Eclipse (using M2Eclipse) and run DevMode is explained in the FAQ: http://web.archive.org/web/20130619170526/https://developers.google.com/eclipse/docs/faq#gwt_with_maven




回答2:


May be you have to set the copyWebapp parameter to true?

<configuration>
    <style>PRETTY</style>
    <strict>true</strict>
    <runTarget>index.html</runTarget>
      ...
    <copyWebapp>true</copyWebapp>
</configuration>



回答3:


Our .pom uses this:

<properties>
    <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
    <gwt.war.directory>${project.build.directory}/war</gwt.war.directory>
</properties>

In the Arguments tab of the debug configuration we use:

-remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -startupUrl appname.jsp -logLevel INFO -port 8888 -codeServerPort 9997 -war "${workspace_loc:appname/target/war}" com.yourcompany.app

Seems to work without the problem you are having.




回答4:


I am not sure if this is a problem faced only by me, but even after following the steps specified in the maven plugin configuration the issue had occurred to me randomly. But nowadays its not happening and this is what I did differently.

  1. Use the gwt only in eclipse java perspective, not in j2ee perspective.

  2. In eclipse->project properties->Google->Web application, check the Launch and deploy from this directory option.




回答5:


I was caught out by this too. If you put your static files for the webapp into the "src/main/webapp" folder, they will be copied over to the target folder if the tickbox in Settings->Web Application is unchecked (as it would be by default if it's an M2eclipse project).

I set my target folder to be the "war" folder on the project and ignored it in version control.



来源:https://stackoverflow.com/questions/19010533/gwt-maven-webapp-files-getting-deleted-when-running-in-dev-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!