From BC$ MobileTV Wiki
Revision as of 15:49, 28 September 2019 by Bcmoney (Talk | contribs)

Jump to: navigation, search
Apache Software Foundation (ASF) logo
Apache Maven project

Maven is a dependency management system and build tool for rapid Java-based application development with rich features to streamline development and SCM. Maven is a Yiddish word which means "accumulator of knowledge". The Maven Project started out as an attempt to simplify build processes in a project with multiple Ant build scripts. It was proposed that a standard way to build projects, clearly define what a project consists of, easily publish project information and share JARs across several different projects would greatly simplify and lend efficiency and speed to the Java development process.


Although hardly a comprehensive list, these are the most common default lifecycle phases executed.

  • validate - validate the project is correct and all necessary information is available
  • compile - compile the source code of the project
  • test - test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
  • package - take the compiled code and package it in its distributable format, such as a JAR.
  • integration-test - process and deploy the package if necessary into an environment where integration tests can be run
  • verify - run any checks to verify the package is valid and meets quality criteria
  • install - install the package into the local repository, for use as a dependency in other projects locally
  • deploy - done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.

There are two other Maven lifecycles of note beyond the default list above. They are

  • clean - cleans up artifacts created by prior builds
  • site - generates site documentation for this project


Build Commands

The following are some useful commands (don't forget to remove "mvn" before adding a command to a Run Configuration in your IDE of choice, the plugin will automatically call Maven).

Standard full clean & install (with complete maven repository building of dependencies via POM dependency list):

mvn clean install -PautoInstallPackage

Clean the target directory, build and explode out a WAR file, run it in an embedded Jetty server (should be configured properly in pom.xml).

mvn clean war:exploded jetty:run -e

Run unit tests:

mvn test

Package a runnable JAR, WAR or EAR:

mvn package

Build a new snapshot and release:

mvn -U deploy

An interesting thing to note is that phases and goals may be executed in sequence:

mvn clean dependency:copy-dependencies package


In Maven, the Project Object Model (POM) is the term given to the XML-based definition of a project (similar to DOAP), which focuses on providing a listing of Dependencies (libraries, supporting tools, etc), where to download or obtain those Dependencies, and how to use those dependencies together with the code contained in the software project in order to successfully perform a Build. It also provides a linkage to Defect Management (aka. Issue Management) & Testing tools. The following is an empty template for the syntax of the POM file.

 <project xmlns=""

  <!-- The Basics -->

  <!-- Build Settings -->

  <!-- Additional Project Information -->

   <!-- Environment Settings -->









[5] [6]

Continuous Integration

Continuous Integration

Static Code Analysis





Config processor


Exec (command-line)


Language Extensions

While just about any program can be run remotely in a cloud environment via the CloudTools plugin, or by calling a local program from the command-line via the Exec plugin, there are still instances when you want to work more closely with a given programming language's specific tools such as compilers, testing suites, IDEs, etc. You can accomplish this by using one of the many Language-specific Maven extensions.








[17] [18] [19]


External Links


  1. Maven in 5 Minutes:
  2. Tutorial -- Build a JAR file with Maven in 5 minutes:
  3. :
  4. Read FILE properties via maven-properties plugin:
  5. mvn exec plugin -- Usage: (valid
  6. mvn exec plugin -- Changing the classpath scope when running Java programs:
  7. Maven – PMD example:
  8. Analyzing JavaScript Code:
  9. Introduction to FindBugs:
  10. FindBugs Maven Plugin tutorial:
  11. Native C/C++ Maven Plugin (usage):
  12. How do I use Maven through a proxy?:
  13. Maven -- Versions plugin - Changing the project version:
  14. Maven -- Versions plugin - Advancing dependency versions:
  15. Maven -- Versions plugin - Replacing -SNAPSHOT versions with their corresponding releases:
  16. Robustly enforcing a minimum Maven version for your project:
  17. Creating Profile Specific Configuration Files With Maven:
  18. Build profiles -- (environment-specific) properties filtering example "pom.xml":
  19. Maven - How do I activate a profile from command line?:
  20. m2eclipse wont download maven artifacts:
  21. Unable to download jars using M2Eclipse (0.10.0, using Maven 3):
  22. NetBeans Platform Quick Start Using Maven:
  23. Maven 3 support in NetBeans IDE 7.0+:
  24. How to convert a Maven pom.xml into an Ivy ivy.xml file :
  25. Convert Maven POM dependencies to ivy.xml file:
  26. NetBeans Platform Maven Command Line Tutorial:
  27. NetBeans Platform Quick Start Using Maven:
  28. Creating an Enterprise Application Using Maven
  29. NB - Convert a project to Maven?:
  30. Converting a Netbeans project to a Maven enabled project:
  31. How to Create Web Application using Maven and Netbeans:
  32. Add JDBC in Netbeans Maven Project:
  33. NetBeanws -- Testing a Maven Enterprise Application:
  34. Code Sharing (amongst several team members)? Use Maven:
  35. Maven & Jenkins with Selenium: Complete Tutorial:
  36. Maven – How to skip unit test:
  37. Difference between -Dmaven.test.skip=true and -DskipTests in Maven:
  38. Maven skip tests (explained):
  39. maven profiles - load based on environment :
  40. m2e lifecycle-mapping not found:

See Also

Ant | Java | CI | Testing | SCM