Skip to content

Commit 80285f4

Browse files
committed
MAven equivalent of setting spark.executor.extraClasspath during tests.
1 parent 034b369 commit 80285f4

File tree

3 files changed

+65
-8
lines changed

3 files changed

+65
-8
lines changed

core/pom.xml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,17 @@
329329
<plugin>
330330
<groupId>org.scalatest</groupId>
331331
<artifactId>scalatest-maven-plugin</artifactId>
332-
<configuration>
333-
<environmentVariables>
334-
<SPARK_HOME>${basedir}/..</SPARK_HOME>
335-
<SPARK_TESTING>1</SPARK_TESTING>
336-
<SPARK_CLASSPATH>${spark.classpath}</SPARK_CLASSPATH>
337-
</environmentVariables>
338-
</configuration>
332+
<version>1.0</version>
333+
<executions>
334+
<execution>
335+
<id>test</id>
336+
<goals>
337+
<goal>test</goal>
338+
</goals>
339+
</execution>
340+
</executions>
339341
</plugin>
342+
340343
<!-- Unzip py4j so we can include its files in the jar -->
341344
<plugin>
342345
<groupId>org.apache.maven.plugins</groupId>

examples/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,16 @@
184184
<outputDirectory>target/scala-${scala.binary.version}/classes</outputDirectory>
185185
<testOutputDirectory>target/scala-${scala.binary.version}/test-classes</testOutputDirectory>
186186
<plugins>
187+
<plugin>
188+
<groupId>org.codehaus.gmaven</groupId>
189+
<artifactId>gmaven-plugin</artifactId>
190+
<version>1.4</version>
191+
<executions>
192+
<execution>
193+
<phase>none</phase>
194+
</execution>
195+
</executions>
196+
</plugin>
187197
<plugin>
188198
<groupId>org.apache.maven.plugins</groupId>
189199
<artifactId>maven-deploy-plugin</artifactId>

pom.xml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,13 @@
142142
<aws.kinesis.client.version>1.1.0</aws.kinesis.client.version>
143143
<commons.httpclient.version>4.2.6</commons.httpclient.version>
144144
<commons.math3.version>3.1.1</commons.math3.version>
145-
145+
<test_classpath_file>${project.build.directory}/spark-test-classpath.txt</test_classpath_file>
146146
<PermGen>64m</PermGen>
147147
<MaxPermGen>512m</MaxPermGen>
148+
<scala.version>2.10.4</scala.version>
149+
<scala.binary.version>2.10</scala.binary.version>
150+
<jline.version>${scala.version}</jline.version>
151+
<jline.groupid>org.scala-lang</jline.groupid>
148152
</properties>
149153

150154
<repositories>
@@ -961,6 +965,7 @@
961965
<spark.test.home>${session.executionRootDirectory}</spark.test.home>
962966
<spark.testing>1</spark.testing>
963967
<spark.ui.enabled>false</spark.ui.enabled>
968+
<spark.executor.extraClassPath>${test_classpath}</spark.executor.extraClassPath>
964969
</systemProperties>
965970
</configuration>
966971
<executions>
@@ -1022,6 +1027,45 @@
10221027
</pluginManagement>
10231028

10241029
<plugins>
1030+
<!-- This plugin dumps the test classpath into a file -->
1031+
<plugin>
1032+
<groupId>org.apache.maven.plugins</groupId>
1033+
<artifactId>maven-dependency-plugin</artifactId>
1034+
<version>2.9</version>
1035+
<executions>
1036+
<execution>
1037+
<phase>test-compile</phase>
1038+
<goals>
1039+
<goal>build-classpath</goal>
1040+
</goals>
1041+
<configuration>
1042+
<includeScope>test</includeScope>
1043+
<outputFile>${test_classpath_file}</outputFile>
1044+
</configuration>
1045+
</execution>
1046+
</executions>
1047+
</plugin>
1048+
1049+
<!-- This plugin reads a file into maven property. And it lets us write groovy !! -->
1050+
<plugin>
1051+
<groupId>org.codehaus.gmaven</groupId>
1052+
<artifactId>gmaven-plugin</artifactId>
1053+
<version>1.4</version>
1054+
<executions>
1055+
<execution>
1056+
<phase>process-test-classes</phase>
1057+
<goals>
1058+
<goal>execute</goal>
1059+
</goals>
1060+
<configuration>
1061+
<source>
1062+
def file = new File(project.properties.test_classpath_file)
1063+
project.properties.test_classpath = file.getText().split().join(":")
1064+
</source>
1065+
</configuration>
1066+
</execution>
1067+
</executions>
1068+
</plugin>
10251069
<!-- The shade plug-in is used here to create effective pom's (see SPARK-3812). -->
10261070
<plugin>
10271071
<groupId>org.apache.maven.plugins</groupId>

0 commit comments

Comments
 (0)