官术网_书友最值得收藏!

Maven project structure

The Maven project wizard creates src and target folders under the main project folder. As the name suggests, all source files go under src. However, Java package structure starts under the main folder. By convention, Maven expects Java source files under the java folder. Therefore, create a java folder under src/main. The Java package structure starts from the java folder, that is, src/main/java/<java-packages>. Web content such as HTML, JS, CSS, and JSP goes in the webapp folder under src/main. Compiled classes and other output files generated by the Maven build process are stored in the target folder:

Figure 2.35: Maven web application project structure

The source code for our login JSF page is the same as in the previous example of LoginJSFApp. Therefore, copy the packt folder from the src folder of that project to the src/main/java folder of this Maven project. This adds LoginBean.java to the project. Then, copy web.xml from the WEB-INF folder to the src/main/webapp/WEB-INF folder of this project. Copy index.xhtml and welcome.xhtml to the src/main/webapp folder:

Figure 2.36: Project structure after adding source files

No change is required in the source code. To run the application, right-click on index.xhtml and select Run As | Run on Server.

We will be using Maven for project management in the rest of this book.

主站蜘蛛池模板: 阿合奇县| 岳普湖县| 手游| 合作市| 汤阴县| 兴文县| 武川县| 定南县| 筠连县| 松阳县| 娄烦县| 南平市| 怀宁县| 沂源县| 双辽市| 德庆县| 乐平市| 保靖县| 凤凰县| 汝州市| 双峰县| 巴东县| 汉川市| 荔浦县| 吉水县| 灌南县| 略阳县| 新邵县| 孟村| 茶陵县| 宁津县| 乌海市| 南丹县| 栾城县| 长顺县| 蓬安县| 盐城市| 济源市| 蓝山县| 广安市| 阿克苏市|