Information form
Package | version | download link |
---|---|---|
maven | 3.6.1 | https://maven.apache.org/ |
jdk | jdk1.8.0 | https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html |
Scala | 2.11.7 | https://www.scala-lang.org/download/all.html |
IDEA | The latest version of | http://www.jetbrains.com/idea/ |
idea + java + scala installation configuration
idea + java + scala installation configuration reference another blog post: the Spark development environment to build (IDEA, Scala, SVN, SBT )
maven installation configuration
Enter the official website Home
Download Source switch
Select Download file
Extracting file (the following structure)
Configure the environment variables (by default you will, will not you reference jdk configuration)
Verify maven installation configuration
Configuring the Central Warehouse (C: \ Tool \ maven3.6.1 \ conf \ settings.xml)
Add the following
<!--如果不了解mirrorOf的含义 建议在这里只配置一个阿里云,其他的仓库再pom.xml中配置-->
<mirrors>
<!-- nexus-aliyun 首选,放第一位,有不能下载的包,再去做其他镜像的选择 -->
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
For example, most of my jar from Ali cloud,
but I use the spark is cdh or hdp's, found in Ali inside the cloud,
then I configure my warehouse-related information can be added in pom.xml file
<!--hdp仓库-->
<repositories>
<repository>
<id>hortonworks</id>
<url>https://repo.hortonworks.com/content/repositories/releases/</url>
</repository>
</repositories>
Configuring local repository
Purpose: The default warehouse C:\Users\Administrator\.m2
,
along with changes to the project, the jar may need more and more,
if the system disk exists consume a large amount of space, so you can migrate the warehouse to a non-system disk.
The default system disk
- Modify the configuration file (
C:\Tool\maven3.6.1\conf\settings.xml
)
to add the following
<!--因为我只有一个ssd,且只有一个盘,所以还放在C盘,各位自己随意-->
<localRepository>C:/Tool/maven3.6.1/repository</localRepository>
- Mobile configuration file
willC:\Tool\maven3.6.1\conf\settings.xml
be moved toC:\Users\Administrator\.m2
the (two sides must ensure that the contents of the file as)
deleteC:\Users\Administrator\.m2
underrepository
Folders
(This step can not do it, you can specify the path to the configuration file when the idea of creating the project)
Configuring idea
- Create a new maven project
- Configuration jdk
- SDK configuration
(according to the actual selection)
- Add scla structure
create a file called scala folder in the main folder
Right-click the scala folder,
selection Make Directory as
,
and selection Sources Root
,
(the scala root folder is marked as a source file, then all the codes in the Package therein, its path from the root directory to begin to run.)
- Established in scala scala file
Configuration pom.xml
<?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>TestMaven</groupId>
<artifactId>cn.lilcol</artifactId>
<version>1.0-SNAPSHOT</version>
<!--aliyun外的仓库-->
<repositories>
<repository>
<id>hortonworks</id>
<url>https://repo.hortonworks.com/content/repositories/releases/</url>
</repository>
</repositories>
<!--具体依赖-->
<dependencies>
<!--spark-core_2.11:https://repo.hortonworks.com/content/repositories/releases/-->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.3.2.3.1.0.0-78</version>
</dependency>
<!--spark-streaming_2.11:https://repo.hortonworks.com/content/repositories/releases/-->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.11</artifactId>
<version>2.3.2.3.1.0.0-78</version>
</dependency>
<!--spark-sql_2.11:https://repo.hortonworks.com/content/repositories/releases/-->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.3.2.3.1.0.0-78</version>
</dependency>
</dependencies>
</project>
Add rely wait to see the completion of a local warehouse
External Libraries view the situation under (its dependencies have been added)
Check local repository (dependent has been stored in a local repository)
So far environment configuration
article for the original article, please indicate the source! ! !