Article Directory
1. Idea configuration maven environment
1.1 Configure maven path, local warehouse
File —>settings —>Search maven —>Specify the maven directory, configure the maven path, the local warehouse path
(Local repository: local repository, the package downloaded from the central warehouse can be found in this folder)
1.2 Solve the problem of slow build when creating a maven project
(Because plug-in resources are downloaded when the project is built, which makes the initial build time-consuming.
Solution : Set the VM options value in the Runner under Maven:-DarchetypeCatalog=internal
2. Maven creates JAVASE project
- File —> new Project —> select the maven project —> check create from archetype —> select quickstart
- Specify a coordinate for the project to be created, because my project can be packaged into a package and released to the warehouse in the future, you must specify the coordinate.
- After creating the project, be sure to click on Event-Log in the lower right corner: Import Changes Enable Auto-Import, you can automatically import the jar package from the warehouse
2.1 Maven creates the directory structure of the JAVASE project
3. Maven creates a javaweb project (create multiple mavens in a Project) [***]
- Create an empty project to create a project (you can choose quickstart as a maven template)
- Then on the new Module of the created project, select the webapp project and
create it successfully:
3.1 Maven creates the directory structure of the javaweb project
4. Commonly used commands for maven projects
Maven comes with some commands for project management:
maven command | description |
---|---|
clean | Clear the project compilation files, delete the target folder under the project |
compile | Recompile the project and generate the target folder under the project |
package | Mark the current project into the war/jar package target folder, and finally publish the war package to the Linux server |
install | Publish the current project to the local warehouse |
test | Execute test program |