Syria : Through the previous preparatory work, we can now create a Maven Project , The specific process is as follows ;



Maven Preliminary construction of the project



1、 Using tools

  • Eclipse
  • 1.8 Version of jdk

2、 Create project

2.1、 Create a Maven project

Select from the page ;
 Create a picture description of the project


2.2、 Choose project name and location

After the initial selection in the previous step, enter the configuration interface as shown in the figure below , In this interface, just check the selection box in the red box above and below ;
 Configuration interface picture description

What does the red box mean Create a simple project ( Skip prototype selection ), This sentence can also be translated as Skip skeleton selection , That is to say, all the required folders will exist , There's no need to manually create , If you do not check this box, you will enter Maven The prototype selection interface of the project , Here's the picture :
 Prototype selection interface picture description

The specific problems in this case will not be discussed here ~


2.3、Maven The core configuration of the project

Select the box to create a simple project and enter Maven The core configuration of the project ( It will eventually exist in pom.xml In file ), The configuration interface and its explanation are shown in the figure below :
 Core configuration picture description

Explain in detail :
 Insert picture description here

Be careful :Maven The projects are all war How type is packaged ;


3、 New project problem fix

The newly created Maven It's a problem that happens in every project ~, As shown in the figure below, when we click on the newly created Maven The following problems will appear in the project :
 The newly created Maven Picture description of the problem in the project

Will see Maven There is a red cross on the core configuration file of , It's a normal question , We just need to create a folder named under the folder of the project folder , And create a folder named xml File can ~, After creation, the style is as follows :
 Insert picture description here

When we finished creating the folder and xml After the file, you will find that the file has no error ~


4、 To configure Maven The compiled item of the project

Its configuration is in Maven In the core configuration file of the project , both : In file ~, The raw data in the file is as follows :
>pom.xml Image description of the original data in the file

These are the data that were before Maven The core configuration of the project The data you fill in ~

About jdk The code to compile the configuration needs to be written in , And write it under the raw data , The configuration code is as follows :

<build>
		<plugins>
			<plugin>
				<!--  Use this jar The related information that needs to be referenced when creating a package maven Enterprise of warehouse / Organization name  -->
				<groupId>org.apache.maven.plugins</groupId>
				<!--  Use this jar The project name of the package  -->
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<!--  Use this jar The source of the package version  -->
					<source>1.8</source>
					<!--  Use this jar The version target of the package  -->
					<target>1.8</target>
					<!--  compile Maven The character set used in the project  -->
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
		</plugins>
	</build>

Be careful :

  • In this configuration, the version numbers of the two must be the same ;
  • The version numbers of and are installed on your own computer jdk Version number of , Don't Scribble or make mistakes ~

5、 test run Maven project

Right click on the item to find --> And click the ( This is the test Maven Whether the project configuration is connected );
 Insert picture description here

Click to see eclipse The column in the console of , If the following message appears, even if it is successful , Otherwise, it is a failure
 Insert picture description here


《END》