Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added functions #216

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

BryanSJamesDev
Copy link

Brief explanation of the functions I added to the modified mvnw code:

  1. print_header(): This function is responsible for printing the header information at the beginning of the script. It displays details such as the script name, user, date, Java Home, and Maven Home. It provides a clear overview of the script's execution environment.

  2. check_maven_wrapper(): This function checks if the Maven Wrapper is configured in the current project. It verifies the presence of the Maven Wrapper files (mvnw or mvnw.cmd and .mvn/wrapper/maven-wrapper.jar) in the Maven base directory. If the Maven Wrapper is not properly configured, it will notify the user.

  3. find_maven_basedir(): This function searches for the Maven base directory by traversing the directory structure from the specified path (or current working directory) to the filesystem root ("/"). It checks if the Maven Wrapper files are present in the current directory or any of its parent directories. Once the Maven base directory is found, it returns the path. If the Maven base directory is not found, it displays an error message.

  4. execute_maven(): This function is responsible for executing the Maven command with the provided arguments. It uses the "$@" notation to pass all the command-line arguments to the Maven command. This function is called at the end of the script to invoke Maven with the appropriate configuration.

These functions enhance the functionality and readability of the mvnw script. They provide additional checks, informative output, and the ability to execute Maven commands based on the project's configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant