gpt4 book ai didi

maven - maven依赖插件和Hadoop

转载 作者:可可西里 更新时间:2023-11-01 16:34:36 26 4
gpt4 key购买 nike

我有一个 jar,其中包含一些 map reduce 代码和一些命令行工具。

为了分发我的依赖项,我使用 maven 依赖项插件将我所有的依赖项打包到我的 jar 中的一个 lib 目录中:

       <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<excludeScope>provided</excludeScope>
</configuration>
</execution>
<execution>
<id>build-classpath</id>
<phase>generate-sources</phase>
<goals>
<goal>build-classpath</goal>
</goals>
<configuration>
configure the plugin here
</configuration>
</execution>
</executions>
</plugin>

当我从命令行 java -cp myJar.jar org.mycompany.MyClass 运行各种类时,我希望让我的 jar 使用 lib 目录

但是,尽管我尽了最大努力来操纵 MANIFEST.MF,但这并没有奏效

<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>./lib/</classpathPrefix>
<mainClass>com.mycompany.MainClass</mainClass>
</manifest>
</archive>
</configuration>

有没有办法不使用 maven-assembly-plugin 来做到这一点?

最佳答案

我假设您正在谈论在 map/reduce 作业中使用这些依赖项。如果是这样,请查看 this article来自 Pere Ferrera Bertran,解释了如何使用 hadoop 的分布式缓存(以及其他两种方式)来做到这一点

关于maven - maven依赖插件和Hadoop,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9640887/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com