Back
Featured image of post About Maven

About Maven

Maven is a build automation tool used primarily for Java projects. Maven can also be used to build and manage projects written in C#, Ruby, Scala, and other languages. The Maven project is hosted by the Apache Software Foundation, where it was formerly part of the Jakarta Project.

Maven


What can Maven do?

  • Dependencies Management: Mange different jar package, package index be stetted in pom.xml
  • Execute code
  • Test code
  • One-click build project

Maven Project Content Structure

  • src/main/java –> core code
  • src/main/resources –> configure files
  • src/test/java –> test code
  • src/test/resources –> test configure files
  • src/main/webapp –> index.html, js, css, images, etc.

Maven Commends

  1. mvn clean –> delete target file why? // if we change env to develop project, because the configuration is different

  2. mvn compile –> generate a new targert file from main file

  3. mvn test –> compile code from main file and test file

  4. mvn package –> (also compile, test)generate target file

  5. mvn install (also compile, test, and package) –> install package into local repository

  6. mvn deploy

​ Project Cycle: from 1 to 5.


Maven Model

  • Dependences management
  • Build project

Create Maven Project in IDE

  • With archetype
  • Without archetype (recommend)

end.

comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy