This repository provides scripts for automatically downloading and installing the latest version of Apache Maven on Windows, Linux, and macOS systems. Each script sets up Maven in the user's Documents folder and configures all necessary environment variables.
- Automatically downloads the latest Maven version
- Installs Maven in the user's Documents folder (
<User>/Documents/maven/
) - Sets up all required environment variables (MAVEN_HOME, M2_HOME, PATH)
- Verifies the installation
- Cleans up temporary files
- Provides detailed feedback during installation
- Supports Windows, Linux, and macOS
- Windows operating system
- PowerShell 5.1 or higher
- Internet connection
- Administrator privileges (for script execution)
- Bash shell
- Internet connection
curl
andgrep
commands installed- Write permissions to ~/Documents
- macOS operating system
- Zsh shell (default since Catalina)
- Internet connection
curl
command installed- Write permissions to ~/Documents
-
Clone this repository:
git clone https://github.com/Contrum/install-maven.git
-
Navigate to the script directory:
cd install-maven
-
If needed, unblock the script:
Unblock-File -Path .\install-maven.ps1
-
Run the script:
.\install-maven.ps1
-
Clone the repository and navigate to it:
git clone https://github.com/Contrum/install-maven.git cd install-maven
-
Make the script executable and run it:
chmod +x install-maven-linux.sh ./install-maven-linux.sh
-
Apply the changes:
source ~/.bashrc
-
Clone the repository and navigate to it:
git clone https://github.com/Contrum/install-maven.git cd install-maven
-
Make the script executable and run it:
chmod +x install-maven-mac.sh ./install-maven-mac.sh
-
Apply the changes:
source ~/.zshrc
- Create a Maven directory in your Documents folder
- Download the latest Maven version from the official Apache website
- Extract the Maven files
- Set up the following environment variables:
- MAVEN_HOME
- M2_HOME
- Add Maven's bin directory to PATH
- Verify the installation by running
mvn -version
After the script completes:
- Restart your terminal/PowerShell/Command Prompt
- Verify the installation by running:
mvn -version
-
Execution Policy Error
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
-
Access Denied
- Make sure you're running PowerShell as Administrator
-
Permission Denied
chmod +x install-maven-*.sh
-
Command Not Found
- Linux: Run
source ~/.bashrc
- macOS: Run
source ~/.zshrc
- Linux: Run
-
Download Issues
- Check your internet connection
- Verify that https://dlcdn.apache.org is accessible
-
PATH Issues
- Restart your terminal after installation
- Verify environment variables are set correctly
We welcome contributions to improve the Maven installer! Here's how you can help:
-
Fork the repository Contrum/install-maven
-
Clone your fork locally
git clone https://github.com/your-username/install-maven.git
-
Create a new branch for your feature
git checkout -b feature/your-feature-name
-
Make your changes
- Keep the code style consistent
- Update documentation if needed
- Test on your target platform
- Ensure the GitHub Action workflows pass
-
Commit your changes using clear commit messages
git commit -m "Add: description of your changes"
-
Push to your fork
git push origin feature/your-feature-name
-
Open a Pull Request to the
main
branch of Contrum/install-maven- Provide a clear description of your changes
- Reference any related issues
- Ensure you have the required shell and tools for your platform
- For Windows: Set execution policy for development:
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
- Test your changes locally before submitting a PR
Found a bug or have a suggestion? Please open an issue:
- Go to Issues
- Click "New Issue"
- Provide a clear description and steps to reproduce if applicable
This project is licensed under the MIT License - see the LICENSE file for details.