I learned about the MAVEN development environment and manually wrote a Maven project, but this is inefficient, and today we are learning to build a MAVEN development environment under Eclipse.
Common MAVEN Commands
- MVN clean: Runs a cleanup operation that deletes data from the target folder
- MVN Clean Compile: Runs the cleanup operation before running the compile operation, which compiles the code into the target folder.
- MVN Clean test: Running cleanup and testing
- MVN Clean Package: Run cleanup and packaging
- MVN clean Install: Running cleanup and installation will install the packaged files into the local repository so that other modules or projects can be configured to call the
- MVN Clean Deploy: Runs cleanup and publishing, which is published to the private server.
Create a project using MVN archetype
So far, we know that the Java class is stored in the fixed path "Src/main/java" folder, and the test class is stored in the "Src/main/test" folder by default, if each time you manually create these folders will be very troublesome, but fortunately, MAVEN has provided us with a "maven archetype" to build the skeleton of the project. These are fixed folders and pom.xml files.
We create a new project "test003", under the command line into the directory, enter the command: "MVN archetype:generate", you can create a project.
The first time you create a project you need to go to Maven's central repository to download something that may be slower and later, you can see the use of "MVN archetype:generate" To create the project, you will be prompted to enter some basic information about the project and what is needed in the Pom.xml file:
GroupId
Artifactid
Package
Version
You can see the basic needs of the directory and the Pom.xml file, MAVEN is automatically created for us.
Eclipse Configuration Maven Plugin
First you need to download the M2eclipse offline package, after the download is complete, the following two directories are extracted:
Restart eclipse in the corresponding directory of the Eclipse installation directory where the corresponding files in the directory's folder are copied. You can see the MAVEN option when you start clicking Window->preferences.
Configure your own Maven
So far, you need to configure your downloaded Maven into eclipse.
Configure the location of the local warehouse
M2eclipse Offline Package
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Eclipse builds MAVEN development environment