搭建一个IntelliJ的Spark项目
之前发现创建一个新项目之后,无法添加scala class
创建新项目
选择maven项目,然后选择simple或者quickstart;
进入项目后,在Project Structure里面,在global libraries面板中,删除已有的scala-sdk,然后再添加;
然后再工程中添加scala文件夹,添加一个package,在package里面就可以添加scala文件了。
Maven
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <groupId>com.cmiot</groupId>
<artifactId>parquetToHbase</artifactId>
<packaging>jar</packaging>
<version>3.2.1-diy-thinrow</version> <repositories>
<repository>
<id>cloudera</id>
<url>https://repository.cloudera.com/cloudera/cloudera-repos</url>
</repository>
<repository>
<id>nexus</id>
<url>https://maven.atlassian.com/3rdparty/</url>
</repository>
</repositories> <dependencies>
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
<version>1.2.1</version>
</dependency> <dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_${spark.tool.version}</artifactId>
<version>${spark.version}</version>
<!--scope>provided</scope-->
<exclusions>
<exclusion>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</exclusion>
<exclusion>
<groupId>org.scala-lang</groupId>
<artifactId>scala-lang</artifactId>
</exclusion>
<exclusion>
<groupId>org.scala-lang</groupId>
<artifactId>scalap</artifactId>
</exclusion>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${spark.tool.version}</artifactId>
<version>${spark.version}</version>
<!--scope>provided</scope-->
</dependency>
<!--<dependency>-->
<!--<groupId>com.oracle</groupId>-->
<!--<artifactId>ojdbc6</artifactId>-->
<!--<version>11.2.0.4.0-atlassian-hosted</version>-->
<!--</dependency>
<dependency>
<groupId>oracle</groupId>
<artifactId>ojdbc</artifactId>
<version>8</version>
</dependency>-->
<dependency>
<groupId>com.github.nscala-time</groupId>
<artifactId>nscala-time_${scala.version.tools}</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency> <dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-reflect</artifactId>
<version>${scala.version}</version>
</dependency> <dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.version.tools}</artifactId>
<version>${scala.test.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.scalacheck</groupId>
<artifactId>scalacheck_${scala.version.tools}</artifactId>
<version>${scala.check.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.log4j12.version}</version>
<!--<scope>test</scope>-->
</dependency>
<dependency>
<groupId>org.alluxio</groupId>
<artifactId>alluxio-core-client</artifactId>
<version>${alluxio.client.version}</version>
</dependency>
<dependency>
<groupId>com.databricks</groupId>
<artifactId>spark-xml_${spark.tool.version}</artifactId>
<version>${spark.xml.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>${hbase.version}</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-server</artifactId>
<version>${hbase.version}</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-spark</artifactId>
<version>1.2.0-cdh5.10.2</version>
</dependency>
-->
</dependencies> <properties>
<hbase.version>1.2.0-cdh5.11.2</hbase.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<maven.surefire.version>2.7</maven.surefire.version>
<maven.compiler.version>3.1</maven.compiler.version>
<maven.assembly.version>2.4</maven.assembly.version>
<java.version>1.8</java.version>
<scala.version>2.11.8</scala.version>
<scala.version.tools>2.11</scala.version.tools>
<scala.maven.version>3.2.0</scala.maven.version>
<scala.check.version>1.11.4</scala.check.version>
<scala.test.version>3.0.1</scala.test.version>
<scala.test.maven.version>1.0</scala.test.maven.version>
<junit.version>4.11</junit.version>
<spark.version>2.1.0.cloudera2</spark.version>
<spark.tool.version>2.11</spark.tool.version>
<spark.xml.version>0.4.1</spark.xml.version>
<alluxio.client.version>1.0.0</alluxio.client.version>
<cobertura.version>2.7</cobertura.version>
<slf4j.log4j12.version>1.7.10</slf4j.log4j12.version>
<test.arg.line>-Xms1024m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=1024m</test.arg.line>
</properties> <profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<filters.env>dev</filters.env>
</properties>
</profile> <profile>
<id>test</id> <properties>
<filters.env>test</filters.env>
</properties>
</profile> <profile>
<id>prod</id>
<properties>
<filters.env>prod</filters.env>
</properties>
</profile>
</profiles> <build>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<filters>
<filter>${project.basedir}/filters/${filters.env}/conf.properties</filter>
</filters>
<plugins> <plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala.maven.version}</version>
<executions>
<execution>
<id>scala-compile</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<!---->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven.assembly.version}</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.cmiot.StatsApp</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<configuration>
<argLine>${test.arg.line}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>${scala.test.maven.version}</version>
<configuration>
<skipTests>false</skipTests>
<reportsDirectory>${project.build.directory}/test-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>WDF TestSuite.txt</filereports>
<argLine>${test.arg.line}</argLine>
</configuration>
<executions>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>${cobertura.version}</version>
<configuration>
<formats>
<format>xml</format>
<format>html</format>
</formats>
<check/>
<instrumentation>
<ignores>
<ignore>com.cmiot.StatsApp</ignore>
<ignore>com.cmiot.app</ignore>
</ignores>
<excludes>
<exclude>com/cmiot/StatsApp*</exclude>
<exclude>com/cmiot/app/Stats*</exclude>
</excludes>
</instrumentation>
</configuration>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
-->
</plugins>
</build>
</project>
搭建一个IntelliJ的Spark项目的更多相关文章
- 手把手搭建一个完整的javaweb项目
手把手搭建一个完整的javaweb项目 本案例使用Servlet+jsp制作,用MyEclipse和Mysql数据库进行搭建,详细介绍了搭建过程及知识点. 下载地址:http://download.c ...
- 小记如何有顺序的搭建一个Spring的web项目
如何有顺序的搭建一个Spring的web项目 一.新建一个简单的maven,war工程 eclipse下如有报错,右键 Deployment 单击 Generate 生成web.xml后可解决报错 二 ...
- 快速搭建一个基于react的项目
最近在学习react,快速搭建一个基于react的项目 1.创建一个放项目文件夹,用编辑器打开 2.打开集成终端输入命令: npm install -g create-react-app 3. cre ...
- react全家桶从0搭建一个完整的react项目(react-router4、redux、redux-saga)
react全家桶从0到1(最新) 本文从零开始,逐步讲解如何用react全家桶搭建一个完整的react项目.文中针对react.webpack.babel.react-route.redux.redu ...
- 使用Intellij IDEA搭建一个简单的Maven项目
IntelliJ IDEA是Java最优秀的开发工具,它功能全面,提示比较智能,开发界面炫酷,新技术支持的比较迅速. 我使用了Eclipse快10年了,IntelliJ IDEA这么好用必须要试一试. ...
- 用Eclipse 搭建一个Maven Spring SpringMVC 项目
1: 先创建一个maven web 项目: 可以参照之前的文章: 用Maven 创建一个 简单的 JavaWeb 项目 创建好之后的目录是这样的; 2: 先配置maven 修改pom.xml & ...
- .net core 2.0学习记录(一):搭建一个.Net Core网站项目
.Net Core开发可以使用Visual Studio 2017或者Visual Studio Code,下面使用Visual Studio 2017搭建一个.net Core MVC网站项目. 一 ...
- Vue.js学习笔记--菜鸟搭建一个企业级vue的项目
vue.js新手搭建一个企业项目,从0开始 前置条件: node.npm请先安装配置好 下面开始: npm 下载vue-cli脚手架工具 确认安装成功看到版本号: 初始化项目,选用webpack(p ...
- 搭建一个简单的React项目
我是使用了create-react-app来搭建的基本框架,其中的原理和vue-cli差不多的脚手架.(当然也可以自己配置项目目录,这里我偷了一下懒) npm install -g create-re ...
随机推荐
- 第七天 Linux用户管理、RHEL6.5及RHEL7.2 root密码破解、RHEL6.5安装vmware tools
1.Linux用户管理 Linux系统中,存在三种用户 A.超级用户:root 最高权限,至高无上 在windows中 administrator是可以登录的最高权限,但是,system权限最高,不能 ...
- c++复习要点
自增和自减运算符有前缀和后缀两种形式,都会改变对象,所以不能对常量对象操作. 前缀形式返回改变后的对象,返回*this. 后缀形式返回改变之前的值,所以必须创建一个代表这个值的独立对象并返回它,是通过 ...
- 记录selenium操作
# -*- coding: utf-8 -*- # coding:utf-8 必须在第一行才能支持中文注释 #!/usr/bin/python # android-build.py # Build a ...
- css实现水平 垂直居中
css实现水平居中 <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...
- PHP---初探PHP
初探PHP 虽然说前后端分离,但作为前端还是要跟数据打交道的,所以对后台语言的了解还是很有必要的.今天要学的就是PHP. 什么是PHP? PHP(外文名:PHP: Hypertext Preproce ...
- js排序算法03——选择排序
选排序的思路是首先从要排序的数组中选择最小的和目前的第一位交换位置,然后从剩下的数中选择最小的和第二个位置的数交换位置,再从剩下的数中选择最小的和第三个位置的数交换位置,以此类推,实现代码如下: fu ...
- 同步锁Lock
用于解决多线程安全问题有三种方式: 同步代码块(隐式锁,基于JVM) 同步方法(隐式锁,基于JVM) 同步锁(显式锁,jdk1.5后出现,相对于前两种方式,更加灵活) 下面通过一段程序来说明一下同步锁 ...
- HDU 5831 Rikka with Parenthesis II (贪心)
Rikka with Parenthesis II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Jav ...
- LeetCode OJ:Implement strStr()(实现子字符串查找)
Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle ...
- 说说C++多重继承
尽管大多数应用程序都使用单个基类的公用继承,但有些时候单继承是不够用的,因为可能无法为问题域建模或对模型带来不必要的复杂性.在这种情况下,多重继承可以更直接地为应用程序建模. 一.基本概念 多重继承是 ...