有没有办法在S3上添加作为Zeppelin依赖项的jar中的jar?尝试了z.load(s3n://...)
和z.addRepo(some_name).url(s3n://...)
,但他们似乎无法完成这项工作......
答案 0 :(得分:4)
您可以从S3下载jar并将其放在本地FS上。它可以在%dep 解释器中完成,如下所示:
%dep
import com.amazonaws.services.s3.AmazonS3Client
import java.io.File
import java.nio.file.{Files, StandardCopyOption}
val dest = "/tmp/dependency.jar"
val s3 = new AmazonS3Client()
val stream = s3.getObject("buckename", "path.jar").getObjectContent
Files.copy(stream, new File(dest).toPath, StandardCopyOption.REPLACE_EXISTING)
z.load(dest)
注意:您必须生成胖jar,即包括默认情况下未提供的所有自定义依赖项(例如,当您的项目中有多个模块时)。在maven中,它可以用maven-shade-plugin实现:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>com.yourcompany:*</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>