type
status
date
slug
summary
tags
category
icon
password
📒
个人建解,参考了文章总结出来的

如何不用Maven打包

一、配置MapReduce开发环境

1.新建一个项目:

构建系统选择Intellij
notion image
 

2.导入MapReduce开发所需要的包:

这里上传三个我用的包,如果有其它需要,自行添加
 
在项目目录下创建一个文件夹用于存放所需要的jar包
notion image
 
打开 文件>项目结构 File>Project Structure
点击 模块>(你的项目)>依赖 Modules>(你的项目)>Dependencies
点击 加号(+)
选择 jar或目录
选择 你存放jar包的文件夹
notion image
notion image
最后点击确认

3.编写代码

这里用最简单单词计数来做演示
 

4.对项目进行构建

点击 …>项目结构>工件
点击 加号>Jar>来自具有依赖的模块
notion image
 
选择主类为你所需要打包项目的Driver类
notion image
notion image
 
点击 构建>构建项目
点击 构建>构建工件>重新构建
notion image
 

PS:如果你一个项目文件中有多个项目,可以通过更改

scr>META-INF>MANINFEST.MF

将Main-Class改为自己想打包的项目的Driver类

notion image
 

5.运行你的MapReduce程序

你可以在项目文件夹的 out/artifacts/(项目名称) 下找到打包好的jar文件
创建所需测试的文件
notion image
 
将文件传到hdfs上
notion image
 
输入命令,运行你的jar文件
ps:这里就不用填入jar路径了
 
最后查看运行出的结果
notion image