Create a web version of MAVEN Engineering in Eclipse and learn more about the configuration settings issues for scope in Pom.xml

Source: Internet
Author: User
Tags configuration settings

1. Create a web version of MAVEN project in Eclipse:


A, like creating a Java version of the MAVEN project, first select a simple project (skip the Classic mode), then fill in the coordinates (do not know the previous blog post), in the packaging method to select the war package, then click Finish.


650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/95/D8/wKiom1kagxvSRHtUAAA2DpkEbZw030.png "title=" 00. PNG "alt=" Wkiom1kagxvsrhtuaaa2dpkebzw030.png "/>


650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/95/D8/wKioL1kag8GgkTkDAABFgWToJDY761.png "title=" 01. PNG "alt=" Wkiol1kag8ggktkdaabfgwtojdy761.png "/>


b, you can see, in the new javaproject03 project, only the WebApp directory, and the actual content does not. Here we have to do the setup every time we create a new one. Settings are as follows:


650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/95/DB/wKioL1kal6uispevAAAv68HF8Yg650.png "title=" 07. PNG "alt=" Wkiol1kal6uispevaaav68hf8yg650.png "/>


650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/95/D8/wKiom1kahK3Dbj5YAAD4K7wyIuA903.png "title=" 02. PNG "alt=" Wkiom1kahk3dbj5yaad4k7wyiua903.png "/>


650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/95/DB/wKiom1kamPLyG-toAABTbcNnSlM484.png "title=" 08. PNG "alt=" Wkiom1kamplyg-toaabtbcnnslm484.png "/>


650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/95/DB/wKioL1kamQTTiQZFAABTbcNnSlM515.png "title=" 08. PNG "alt=" Wkiol1kamqttiqzfaabtbcnnslm515.png "/>


Note: The mouse stops on the project you built, right-click to enter Properties---Project Facets, you can find the Dynamic Web Module is checked, uncheck the Apply button, then click the check box, and a hyperlink will be displayed directly below.


C, click the hyperlink, set the desired directory on Content directory, and tick the box that automatically generates the Web. XML deployment Descriptor.


650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/95/DC/wKiom1kambnD-sQFAABi3s196og675.png "title=" 09. PNG "alt=" Wkiom1kambnd-sqfaabi3s196og675.png "/>


D. After clicking on the app, the required content is displayed on the WebApp.


650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/95/DC/wKioL1kaml_yHHPDAAAR9-sEZZw031.png "title=" 10. PNG "alt=" Wkiol1kaml_yhhpdaaar9-sezzw031.png "/>


2, to further understand the scope of the Pom.xml configuration settings issues, easy to identify in eclipse.


650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/95/DD/wKiom1kanE7xomjpAABzXLGfmIg730.png "title=" 11. PNG "alt=" Wkiom1kane7xomjpaabzxlgfmig730.png "/>


650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/95/DD/wKiom1kanTHSK3G4AABfRv5eGZ0276.png "title=" 14. PNG "alt=" Wkiom1kanthsk3g4aabfrv5egz0276.png "/>


650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/95/DD/wKiom1kanM2CbaKSAAB1mFYE6Ig893.png "title=" 13. PNG "alt=" Wkiom1kanm2cbaksaab1mfye6ig893.png "/>


650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/95/DD/wKioL1kanyXzGFh4AAAaF9n6SHo742.png "title=" 15. PNG "alt=" Wkiol1kanyxzgfh4aaaaf9n6sho742.png "/>


Note: In the Pom.xml file, type:


<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
</dependencies>

This is the location and name of MAVEN's coordinates locator jar package to log4j, its relative position and name is Repmaven\log4j\log4j-1.2.17.jar. After the WebApp directory (equivalent to the Webcontext directory) to create a newfile.jsp, and then run the right-click running as---run on server, after the run stopped, in the deployment project Lib package only log4j-1.2. 17.jar.

(Note that test and provided dependencies are not involved in packaging and deployment, compile is involved in packaging and deployment, and the default scope is compile.) )


This article is from the "12392717" blog, please be sure to keep this source http://12402717.blog.51cto.com/12392717/1926229

Create a web version of MAVEN Engineering in Eclipse and learn more about the configuration settings issues for scope in Pom.xml

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.