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.