maven----(Eclipse configuration Chapter)

Source: Internet
Author: User

For Maven, at least in the current development of the use is relatively frequent, but in the IDE integration MAVEN environment, today really let me a headache, generated the project on a variety of small red fork, later integrated various tutorials have been completed, so record:

One, download maven, and the configuration of the environment variable will not be repeated, the commonplace problem

Second, the new Maven local repository, you can create a new folder under a disk, for example, I:

Iii. Configuring the Local repository information in Maven Settings.xml

1 < localrepository > G:\MavenFactory</localrepository>

Iv. Eclispe integrated maven, the new version of Eclispe now has its own MAVEN plugin, if not, self-installing MAVEN plugin, and then in Window--preference, find the path of the settings just modified, click Update

Create a new MAVEN project, right-click the new--maven project----Check the box---and then click "Next"

Fill in the relevant information, packaging there I chose "War", and then click Finish Finish, surprise came, after the completion of the report to me a mistake

Workaround:

Then click on "Generate Deployment descriptor Stub", the above error is good, then click on the item---"Properties"

Six, MAVEN support servlet3.1, need to change the following several files:

(1) Modify the Pom.xml file to add support for servlet3.1 and JDK1.8

1   <!--introduction of servlet3.1 -2   <Dependencies> 3     <Dependency>4        <groupId>Javax.servlet</groupId>  5         <Artifactid>Javax.servlet-api</Artifactid>  6         <version>3.1.0</version>  7         <Scope>Provided</Scope>  8     </Dependency> 9     </Dependencies> Ten    <!--introduction of java1.8 support - One    <Build>   A     <Finalname>Com-demoone</Finalname>   -     <Plugins>   -         <plugin>   the             <groupId>Org.apache.maven.plugins</groupId>   -             <Artifactid>Maven-compiler-plugin</Artifactid>   -             <version>3.1</version>   -             <Configuration>   +                 <Source>1.8</Source>   -                 <Target>1.8</Target>   +             </Configuration>   A         </plugin>   at     </Plugins>   -   </Build> 

(2) Modify the Web. xml file, as shown in the file location:

Change the Web. XML to the following mode: Web-app to the corresponding 3.1, then save

1 <Web-appxmlns= "Http://xmlns.jcp.org/xml/ns/javaee" 2 Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" 3 xsi:schemalocation= "Http://xmlns.jcp.org/xml/ns/javaee4 http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd "version= "3.1" 5 Metadata-complete= "true"> 6   <Display-name>Com-demoone</Display-name>7   <welcome-file-list>8     <Welcome-file>Index.htm</Welcome-file>9     <Welcome-file>index.jsp</Welcome-file>Ten   </welcome-file-list> One </Web-app>

(3) There is a setting folder in the root directory of the current project, there is a org.eclipse.wst.common.project.facet.core.xml file, after opening, modify

Modify the following two information, then save, the last step, right-click the entire project---"Maven"---"Update Project", you can

Vii. Modify the JDK version information for MAVEN configuration once and for all, add the following to the MAVEN settings.xml file: Then modify the MAVEN configuration in Eclispe, see figure in step four, associate Settings.xml

1 <Profiles>2     < Profile>    3     <ID>jdk-1.8</ID>    4      <activation>    5           <Activebydefault>True</Activebydefault>    6           <JDK>1.8</JDK>    7       </activation>    8     <Properties>    9             <Maven.compiler.source>1.8</Maven.compiler.source>    Ten             <Maven.compiler.target>1.8</Maven.compiler.target>     One             <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>     A     </Properties>     -     </ Profile> -   </Profiles>

maven----(Eclipse configuration Chapter)

Related Article

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.