How to create a project using Maven under Intellij IDEA: intellijmaven

Source: Internet
Author: User

How to create a project using Maven under Intellij IDEA: intellijmaven

Due to habits, I have been using jetbrain IDE. Recently, I was developing a javaEE project and trying to use maven to manage dependencies. So what did I have to write down in the middle?

I. Let's first look at how to use maven to build a project under IDEA.

1. Select "New"> "Project"> "Maven" in IDEA.

Create a webapp Based on the template (archetype: Prototype.

2. Click Next to set parameters.

GroupId: Group Id, usually the package name

ArtifactId: indicates the project name during packaging and publishing.

3. Configure maven in the next step.

Download this XML to maven Directory: http://repo1.maven.org/maven2/archetype-catalog.xml

Click Finish to generate a project

4. Modify the directory of the generated project and add the java directory as the Source directory.

2. When SpringMvc + mybatis is implemented, all non-. java files should be stored in the resources directory. Otherwise, classpath cannot be located.

For example, the mapper file of mybatis is usually put in the Sources directory, that is, the java directory in the example. However, during compilation and running, the resource cannot be found.

Class path resource [com/mygroupid/mapper/] cannot be resolved to URL because it does not exist

If you re-place the mapper file to resources, the compilation will run normally.

In summary, you can use classpath to locate non-. java resources by placing them under resources.

 

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.