Maven-archetype-webapp Directory Structure?

只谈情不闲聊 提交于 2020-02-15 08:11:11

问题


Is there a possibility or a workaroud to use maven-archetype-webapp archetype to generate a maven webapp with plain directory structure like

 /src

    /main

        /java 
        /resources 
        /webapp 

    /test 
        /java 
        /resources 

回答1:


I assume that your issue is the missing java and test folders in a new project when using maven-archetype-webapp. There are no options to make that archetype to add those. Of course you could add them manually after the project was created.

You may find another archetypes in one of these lists:

  • http://myjeeva.com/exclusive-maven-archetype-list.html
  • http://docs.codehaus.org/display/MAVENUSER/Archetypes+List

If there is nothing that matches what you need I suggest creating an own archetype: http://maven.apache.org/guides/mini/guide-creating-archetypes.html

It is quite easy and if you plan to use one several times it's probably worth the effort.




回答2:


Actually I am not very sure of what you are asking, I mean are you looking for an alternative solution to maven-archetype-webapp ?

With maven archetype you can create the above mentioned directory structure without any hassle, of course java and test folders will be missing there.

mvn archetype:generate -DgroupId=com.techidiocy -DartifactId=FirstWeb
-DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false  

2) If you are using eclipse IDE , then you can issue the command mentioned below to convert your maven project into an Eclipse Web Project.

  mvn eclipse:eclipse -Dwtpversion=2.0

This Step 2 is optional , if you are not planning to bind it with eclipse

Thanks



来源:https://stackoverflow.com/questions/17965477/maven-archetype-webapp-directory-structure

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