Skip to content
Snippets Groups Projects
  • Dongjoon Hyun's avatar
    f405de87
    [SPARK-14867][BUILD] Remove `--force` option in `build/mvn` · f405de87
    Dongjoon Hyun authored
    ## What changes were proposed in this pull request?
    
    Currently, `build/mvn` provides a convenient option, `--force`, in order to use the recommended version of maven without changing PATH environment variable. However, there were two problems.
    
    - `dev/lint-java` does not use the newly installed maven.
    
      ```bash
    $ ./build/mvn --force clean
    $ ./dev/lint-java
    Using `mvn` from path: /usr/local/bin/mvn
    ```
    - It's not easy to type `--force` option always.
    
    If '--force' option is used once, we had better prefer the installed maven recommended by Spark.
    This PR makes `build/mvn` check the existence of maven installed by `--force` option first.
    
    According to the comments, this PR aims to the followings:
    - Detect the maven version from `pom.xml`.
    - Install maven if there is no or old maven.
    - Remove `--force` option.
    
    ## How was this patch tested?
    
    Manual.
    
    ```bash
    $ ./build/mvn --force clean
    $ ./dev/lint-java
    Using `mvn` from path: /Users/dongjoon/spark/build/apache-maven-3.3.9/bin/mvn
    ...
    $ rm -rf ./build/apache-maven-3.3.9/
    $ ./dev/lint-java
    Using `mvn` from path: /usr/local/bin/mvn
    ```
    
    Author: Dongjoon Hyun <dongjoon@apache.org>
    
    Closes #12631 from dongjoon-hyun/SPARK-14867.
    f405de87
    History
    [SPARK-14867][BUILD] Remove `--force` option in `build/mvn`
    Dongjoon Hyun authored
    ## What changes were proposed in this pull request?
    
    Currently, `build/mvn` provides a convenient option, `--force`, in order to use the recommended version of maven without changing PATH environment variable. However, there were two problems.
    
    - `dev/lint-java` does not use the newly installed maven.
    
      ```bash
    $ ./build/mvn --force clean
    $ ./dev/lint-java
    Using `mvn` from path: /usr/local/bin/mvn
    ```
    - It's not easy to type `--force` option always.
    
    If '--force' option is used once, we had better prefer the installed maven recommended by Spark.
    This PR makes `build/mvn` check the existence of maven installed by `--force` option first.
    
    According to the comments, this PR aims to the followings:
    - Detect the maven version from `pom.xml`.
    - Install maven if there is no or old maven.
    - Remove `--force` option.
    
    ## How was this patch tested?
    
    Manual.
    
    ```bash
    $ ./build/mvn --force clean
    $ ./dev/lint-java
    Using `mvn` from path: /Users/dongjoon/spark/build/apache-maven-3.3.9/bin/mvn
    ...
    $ rm -rf ./build/apache-maven-3.3.9/
    $ ./dev/lint-java
    Using `mvn` from path: /usr/local/bin/mvn
    ```
    
    Author: Dongjoon Hyun <dongjoon@apache.org>
    
    Closes #12631 from dongjoon-hyun/SPARK-14867.