Skip to content

Conversation

@dongjoon-hyun
Copy link
Member

@dongjoon-hyun dongjoon-hyun commented Apr 23, 2016

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.

    $ ./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.

$ ./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

@SparkQA
Copy link

SparkQA commented Apr 23, 2016

Test build #56780 has finished for PR 12631 at commit 56355fa.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen
Copy link
Member

srowen commented Apr 23, 2016

Yes, on a system with Maven < 3.3.9 installed, you always have to pass --force. This would at least make it optional on the second or subsequent run.

Ideally we could even auto-detect the mvn version, which isn't too hard, and then download and/or use the downloaded copy only if the installed one is too old. What do you think about trying that? I wouldn't want to do it if it ends up being a lot of complexity, but ought to be a few more lines. We could even remove --force then, I suppose, since you have to download it if your local maven is too old.

@dongjoon-hyun
Copy link
Member Author

That sounds good to me. No problem!
I'll update today.
Thank you, @srowen !

@SparkQA
Copy link

SparkQA commented Apr 23, 2016

Test build #56808 has finished for PR 12631 at commit afd7f03.

  • This patch fails build dependency tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-14867][BUILD] Make build/mvn to use the downloaded maven if it exists. [SPARK-14867][BUILD] Remove --force option in build/mvn Apr 23, 2016
@SparkQA
Copy link

SparkQA commented Apr 23, 2016

Test build #56809 has finished for PR 12631 at commit ee883e0.

  • This patch fails build dependency tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

build/mvn Outdated
Copy link
Contributor

@markhamstra markhamstra Apr 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This really should be grep'd from the pom file, as is done with scala_version in install_scala. Also, make sure that the correct maven is downloaded and installed in the case that there isn't any mvn available when this script is run.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @markhamstra .
I'll fix that to read "3.3.9" from pom file.

By the way, what do you mean by "make sure that the correct maven is downloaded and installed in the case that there isn't any mvn available when this script is run"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean that using this build/mvn script should work even if there isn't any version of maven currently installed on the machine (which might be the case, e.g., when using an automated tool to set up a new build node.) I believe that would work with --force previously, and it should work when there isn't a --force option anymore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. For that, I tested already. When there is no maven, this script installs the correct maven. Thank you again!

@SparkQA
Copy link

SparkQA commented Apr 23, 2016

Test build #56810 has finished for PR 12631 at commit d593607.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Member Author

Rebased.

@SparkQA
Copy link

SparkQA commented Apr 24, 2016

Test build #56829 has finished for PR 12631 at commit cfe9b4e.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Apr 24, 2016

Test build #56830 has finished for PR 12631 at commit 8504cce.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Apr 24, 2016

Test build #56836 has finished for PR 12631 at commit b11de8a.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

build/mvn Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you use awk below, would this find the version correctly? awk -F '[<>]' '{print $3}' Looks like it, but I don't know if it's much simpler. You might also use "-n1" consistently like below in the head command.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works as the Jenkins runs.

spark:SPARK-14867$ grep "<maven.version>" pom.xml 
    <maven.version>3.3.9</maven.version>

For simplification, I'm not sure since I borrowed it from the following install_scala() code in the same script. Should I change them both for consistency?

install_scala() {
  # determine the Scala version used in Spark
  local scala_version=`grep "scala.version" "${_DIR}/../pom.xml" | \
                       head -1 | cut -f2 -d'>' | cut -f1 -d'<'`

Please let me know. If needed, I will update both.

@SparkQA
Copy link

SparkQA commented Apr 24, 2016

Test build #56855 has finished for PR 12631 at commit 128618e.

  • This patch fails build dependency tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Apr 24, 2016

Test build #56857 has finished for PR 12631 at commit 2b54019.

  • This patch fails build dependency tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Apr 24, 2016

Test build #56859 has finished for PR 12631 at commit 497dcb5.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Member Author

The test failure seems to be irrelevant to this PR.

[info] Exception encountered when attempting to run a suite with class name: org.apache.spark.streaming.MapWithStateSuite *** ABORTED *** (41 seconds, 299 milliseconds)
[info]   java.io.IOException: Failed to delete: /home/jenkins/workspace/SparkPullRequestBuilder/streaming/checkpoint/spark-d2368db9-6d2a-43ba-b79f-372e51a41ce0

@dongjoon-hyun
Copy link
Member Author

I updated the commit time of the last commit to retrigger Jenkins.

@SparkQA
Copy link

SparkQA commented Apr 25, 2016

Test build #56865 has finished for PR 12631 at commit 55e4c5b.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Member Author

Hi, @srowen .
Now, it's ready for review again.
I think I've addressed all your comments. The last one was about awk command that you recommended.
Currently, Jenkins passes the followings.

========================================================================
Running build tests
========================================================================
exec: curl -s -L https://downloads.typesafe.com/zinc/0.3.9/zinc-0.3.9.tgz
exec: curl -s -L https://downloads.typesafe.com/scala/2.11.8/scala-2.11.8.tgz
exec: curl -s -L https://www.apache.org/dyn/closer.lua?action=download&filename=/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
...

Thank you for your review always. If there is anything to do more, please let me know.

@srowen
Copy link
Member

srowen commented Apr 25, 2016

Yeah that looks good to me.

@dongjoon-hyun
Copy link
Member Author

Thank you, @srowen !

@SparkQA
Copy link

SparkQA commented Apr 25, 2016

Test build #56890 has finished for PR 12631 at commit 20a520a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Member Author

Hi, @srowen .
Could you merge this PR?

@srowen
Copy link
Member

srowen commented Apr 27, 2016

Merged to master

@dongjoon-hyun
Copy link
Member Author

Thank you, @srowen !

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.

4 participants