이 콘텐츠는 선택한 언어로 제공되지 않습니다.

4.2. Install Maven


Prerequisites

The following software must be installed:

  • An archiving tool for extracting the contents of compressed files.
  • Open JDK.

Procedure 4.2. Install Maven

  1. Download Maven.

    1. Enter http://maven.apache.org/download.cgi in the address bar of a browser.
    2. Download apache-maven-[latest-version] ZIP file and save it to your hard drive.
  2. Install and configure Maven.

    • On Red Hat Enterprise Linux

      1. Extract the ZIP archive to the directory where you wish to install Maven.
      2. Open your .bash_profile file in a terminal: vi ~/.bash_profile.
      3. Add the M2_HOME environment variable to the file:
        export M2_HOME=/path/to/your/maven
        Copy to Clipboard Toggle word wrap
      4. Also add the M2 environment variable to the file:
        export M2=$M2_HOME/bin
        Copy to Clipboard Toggle word wrap
      5. Add the M2 environment variable to the file:
        export PATH=$M2:$PATH
        Copy to Clipboard Toggle word wrap
      6. Make sure that JAVA_HOME is set to the location of your JDK. For example:
        export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk.x86_64
        Copy to Clipboard Toggle word wrap
      7. Make sure that $JAVA_HOME/bin is in your PATH environment variable.
      8. Save the file and exit your text editor.
      9. Run this command to ensure the changes take effect: source ~/.bash_profile
      10. Run the following command to verify that Maven is installed successfully on your machine:
        mvn --version
        Copy to Clipboard Toggle word wrap
    • On Microsoft Windows

      1. Extract the ZIP archive to the directory where you wish to install Maven. The subdirectory apache-maven-[latest-version] is created from the archive.
      2. Press Start+Pause|Break. The System Properties dialog box is displayed.
      3. Click the Advanced tab and click Environment Variables.
      4. Under System Variables, select Path.
      5. Click Edit and add the two Maven paths using a semicolon to separate each entry.
        • Add the M2_HOME variable and set the path to C:\path\to\your\Maven.
        • Add the M2 variable and set the value to %M2_HOME%\bin.
      6. Update or create the Path environment variable:
        • Add the %M2% variable to allow Maven to be executed from the command line.
        • Add the variable %JAVA_HOME%\bin to set the path to the correct Java installation.
      7. Click OK to close all the dialog boxes including the System Properties dialog box.
      8. Open Windows command prompt and run the following command to verify that Maven is installed successfully on your machine:
        mvn --version
        Copy to Clipboard Toggle word wrap
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat