SPARK-2955 [BUILD] Test code fails to compile with "mvn compile" without "install" #1879
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(This is the corrected follow-up to https://issues.apache.org/jira/browse/SPARK-2903)
Right now,
mvn compile test-compilefails to compile Spark. (Don't worry;mvn packageworks, so this is not major.) The issue stems from test code in some modules depending on test code in other modules. That is perfectly fine and supported by Maven.It takes extra work to get this to work with scalatest, and this has been attempted: https://github.com/apache/spark/blob/master/sql/catalyst/pom.xml#L86
This formulation is not quite enough, since the SQL Core module's tests fail to compile for lack of finding test classes in SQL Catalyst, and likewise for most Streaming integration modules depending on core Streaming test code. Example:
The issue I believe is that generation of a
test-jaris bound here to thecompilephase, but the test classes are not being compiled in this phase. It should bind to thetest-compilephase.It works when executing
mvn packageormvn installsince test-jar artifacts are actually generated available through normal Maven mechanisms as each module is built. They are then found normally, regardless of scalatest configuration.It would be nice for a simple
mvn compile test-compileto work since the test code is perfectly compilable given the Maven declarations.On the plus side, this change is low-risk as it only affects tests.
@yhuai made the original scalatest change and has glanced at this and thinks it makes sense.