One: Build a maven project using MyEclipse
1. Select Menu File, new, and other
2. Select Maven Project
3, the default selection, direct next
4. Filter by entering WebApp in filter, then select Maven-archetype-webapp, then next
5. Enter the group ID and Artifact ID. The group ID is the organization identity, the package name, the Artifact ID is the project name version, the default value is selected, the package is the project name plus the name Com.mycompany.app.myMavenProject, and then click Finish.
6. After the completion of the project directory as follows
7. New MyEclipse Web Project feature
Right-click Project--"MyEclipse--" Add Web project Capabilites
8, after the completion of the project structure as follows
We can see that the project name has one more webproject mark on it.
9. Right-click Project-"Properties-" Java Build Path
10, add Src/java/java, Src/test/java, src/test/resources several directories (reason: Use MAVEN to follow a directory structure, although you can use other directory structure, but now is a beginner stage, It is not clear how to modify Pom.xml. And according to the MAVEN default structure is also the better choice)
After clicking OK, the directory structure is as follows
11. Select the Allow output folders for sources folders check box, the directory structure is as follows
12, the Src/test/java and Src/test/resources compiled class output to target/test-classes file, Src/main/java and Src/main/resources The default is unchanged
After completion, the results are as follows
13, in order to clear the project, adjust the directory structure order
14, click Finish, MAVEN project has been completed, the directory structure is as follows
Two: Build a Web project with commands
1. Enter cmd into command mode and enter the command to enter the folder where you want to build the MAVEN project
2, use the command mvn archetype:generate
Command Line Input command:mvn archetype:generate -dgroupid=com.mycompany.app-dartifactid=my-webproject - Darchetypeartifactid=maven-archetype-webapp -dinteractivemode=false
maven Create a project command description
MVN archetype:generate fixed notation, the new command can also use MVN archetype:create but it seems that the command was removed after Maven3.
-dgroupid Organization identification (package name)
-dartifactid Project Name
-darchetypeartifactid specify Archetypeid,maven-archetype-quickstart, create a Java PROJECT;MAVEN-ARCHETYPE-WEBAP P, create a Web Project
-dinteractivemode whether to use interactive mode
Archetype is a mvn built-in plugin that creates a Java project skeleton, DgroupId is the name of the package, DartifactId is the project name, Darchetypeartifactid is an available MVN project skeleton, The currently available skeleton has
Here in fact and using MyEclipse to create the project 5th step there is the same effect
3, after the creation is only src/main/resources, we also need to create a new Src/main/java, Src/test/java, src/test/resources directory
3. After the creation is complete, import with MyEclipse
4, after the introduction of the structure as follows
Just like we used the MYECLIPSE directory structure.
Maven Learning Summary Two: building maven projects with MyEclipse and command line