enabled "provided" flag in pom.xml, when creating uber package

This commit is contained in:
Daniel Li 2015-12-03 23:00:16 -08:00
Родитель 445251dbba
Коммит ae41842de0
2 изменённых файлов: 19 добавлений и 6 удалений

Просмотреть файл

@ -65,11 +65,15 @@
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>${spark.version}</version>
<!--the following is placeholder for building uber package. Please keep as-is-->
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.10</artifactId>
<version>${spark.version}</version>
<!--the following is placeholder for building uber package. Please keep as-is-->
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
@ -80,6 +84,8 @@
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.10</artifactId>
<version>${spark.version}</version>
<!--the following is placeholder for building uber package. Please keep as-is-->
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>com.databricks</groupId>
@ -159,8 +165,8 @@
</execution>
</executions>
</plugin>
<!--The comment below is used by build.cmd to add shade-plugin and others. Please don't modify-->
<!--OTHER PLUGINS-->
<!--The comment below is the placeholder by build.cmd to add shade-plugin and others. Please keep as-is-->
<!--OTHER PLUGINS-->
</plugins>
</build>
</project>

Просмотреть файл

@ -33,7 +33,7 @@ function Get-ScriptDirectory
#
function Replace-VariableInFile($variable, $value, $sourceFile, $targetFile)
{
Write-Output "[addotherplugin.Replace-VariableInFile] variable=$variable, value=$value, sourceFile=$sourceFile, targetFile=$targetFile"
Write-Output "[addotherplugin.Replace-VariableInFile] variable=$variable, sourceFile=$sourceFile, targetFile=$targetFile"
if (!(test-path $sourceFile))
{
Write-Output "[addotherplugin.Replace-VariableInFile] [WARNING] $sourceFile does not exist. Abort."
@ -60,14 +60,14 @@ function Replace-VariableInFile($variable, $value, $sourceFile, $targetFile)
#
if (!(test-path $targetPom))
{
Write-Output "[addotherplugin.ps1] [WARNING] $targetPom does not exist. Abort."
Write-Output "[addotherplugin.ps1] [WARNING] $targetPom does not exist. Abort."
Print-Usage
return
}
if (!(test-path $sourcePom))
{
Write-Output "[addotherplugin.ps1] [WARNING] $sourcePom does not exist. Abort."
Write-Output "[addotherplugin.ps1] [WARNING] $sourcePom does not exist. Abort."
Print-Usage
return
}
@ -84,7 +84,14 @@ $otherPlugin = [Io.File]::ReadAllText($sourcePom)
$tempPom = "$temp\$targetPom"
Replace-VariableInFile $variable $otherPlugin $targetPom $tempPom
Copy-Item $tempPom $targetPom -force
#
# enable "<scope>provided</scope>" to exclude run-time spark packages from uber package
#
$content = (Get-Content $tempPom)
$content = $content -replace '<!--\s*<scope>provided</scope>\s*-->', '<scope>provided</scope>'
$content | Out-File $targetPom -force
Write-Output "[addotherplugin.ps1] updated $targetPom"