Hi Suneel Kumar Boyapati,Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
Here are some steps you can follow to resolve this issue:
Check Maven Installation Path: Ensure that Maven is installed in the correct directory by running which mvn. This should return the path to the Maven executable.
Update Environment Variables: Add the following lines to your .bashrc or .bash_profile file to ensure the environment variables are correctly set:
export MAVEN_HOME=/path/to/your/maven
export PATH=$MAVEN_HOME/bin:$PATH
Replace /path/to/your/maven with the actual path to your Maven installation. Then, run source ~/.bashrc to apply the changes.
Verify Permissions: Ensure that the user running the Maven command has the necessary permissions to access the Maven and JAVA_HOME directories.
Check for Multiple Java Installations: If there are multiple Java installations, ensure that the correct Java version is being used by running java -version. Make sure the JAVA_HOME environment variable points to the correct Java installation.
Restart the System: Sometimes, a system restart may be required for the changes to take effect. Please restart your system and verify if the issue persists.
If you have any further queries, do let us know. If the comment is helpful, please click "Upvote".