Convert gwt project into maven gwt project

时间秒杀一切 提交于 2019-12-23 19:44:51

问题


I want to convert a gwt project to a maven project. I did configure->convert to maven. That just created pom.xml and target folder inside my project. The folder structure remains the same because maven project structure is src->main->java. And then I want to create a war file, can anyone help me to do this work.


回答1:


You do not have fully AUTOMagic solution for this.

Steps after Configure->Convert to maven

1) Identify each library jar and version used in the project and add a corresponding dependency section for it in maven pom.

2) Create a build section in your pom and you can specify any folder structure ( suggesting you to prefer src/main/java

3) Add relevant plugins section under build for gwt compilation. Use gwt sample projects as templates.

4) Lots of copy/paste between folders ( if you migrate to maven' src/main/java ). Use Eclipse refactor feature to avoid manual visit to each file.

Stick the GWT sample projects approach for maven pom files. It's easier to troubleshoot with FAQ on the GWT Dev section for Maven and GPE plugin.

Update - Semi Automated solution

  • I came across a concept of automatic maven pom generation called tera-form.
  • Google Groups discussion on this



回答2:


I would use an archetype to create a new maven project with everything set. Then copy all your source files to the src/main/java folder and your tests to the src/test/java.

Normally I use the gwtquery archetype, but you could use any other or the official webAppCreator distributed with the gwt sdk.

mvn archetype:generate  \
    -DarchetypeGroupId=com.googlecode.gwtquery \
    -DarchetypeArtifactId=gquery-archetype  \
    -DarchetypeVersion=1.2.0 \
    -DgroupId=com.mycompany \
    -DartifactId=myproject \
    -DprojectName=MyProject 


webAppCreator -noant -maven -overwrite \
    -out myproject \
     com.mycompany.MyProject


来源:https://stackoverflow.com/questions/14019284/convert-gwt-project-into-maven-gwt-project

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