Apache Maven Review | ソフトウェア開発のギークフィード

Apache Maven Review

Apache Maven Reviews

Apache Maven is a software project management and comprehension tool that make it easy for developers to develop their systems.
you learn a few of the main concepts. Each project contains a file called a POM (Project Object Model), Maven can manage a project’s build, reporting and documentation from a central piece of information. Maven is a build automation tool for Java projects.

Installation Maven

Maven is a Java tool, so you must have Java installed in order to proceed.( JDK version 1.5)

  • Download Maven
  • JAVA_HOME environment variable is set and points to your JDK installation
  • Confirm with in command prompt
  • Creating a Project

    The src/main/java directory contains the project source code, the src/test/java directory contains the test source, and the pom.xml file is the project’s Project Object Model, or POM.

    POM.xml

    This is equivalent to the ANT build xml file. POM is the fundamental unit of work in Maven. It is an XML file that contains the configuration settings for a project build.

  • modelVersion
  • groupId
  • artifactId
  • version
  • dependencies
  • Plugins
  • Dependencies

    There is an element available for declaring dependencies in project pom.xml This is used to define the dependencies that will be used by the project. Maven will look for these dependencies when executing in the local maven repository. If not found, then Maven will download those dependencies from the remote repository and store it in the local maven repository.

    Plugins

    All the execution in Maven is done by plugins. A plugin is mapped to a phase and executed as part of it. A phase is mapped to multiple goals. Those goals are executed by a plugin. We can directly invoke a specific goal while Maven execution. A plugin configuration can be modified using the plugin declaration.

    Maven Build Lifecycle

    Maven defines and follows conventions. Right from the project structure to building steps, Maven provides conventions to follow. If we follow those conventions, with minimal configuration we can easily get the build job done.

    There are three built-in build life cycle ‘clean’, ‘default’ and ‘site’. A life cycle has multiple phases.

  • compile – compiles the source code
  • test – executes unit test cases
  • package – bundles the compiled code (Ex: war / jar)
  • install – stores the built package in local Maven repository
  • deploy – store in remote repository for sharing
  • This will create a sample Maven project skeleton using we can start building the application.We will get a a pom.xml and let us use that to build the newly created Maven project. Go inside the newly created Maven project root and execute the command

    The command line will print out various actions, and end with the following:

    PeerayaLimpiruch

    Leave a reply

    このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください

    ページトップへ