IDEA构建支持cdh版本和scala的maven项目注意事项

 

工具和环境

idea2018.1 ,

scala2.11.8,

scala的idea支持包,下载地址

maven3.3.9

win10系统

1.maven环境配置

下载解压maven包,(也可以使用idea自带的,其目录:\IntelliJ IDEA 2018.1\plugins\maven\lib\maven3)

配置环境变量

新建repository目录作为本地仓库

修改setting.xml,如果不能翻 墙 ,该步骤不能省略

<localRepository>F:\Respository</localRepository>

<mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
     <mirror>
          <id>alimaven</id>
          <mirrorOf>central</mirrorOf>
          <name>aliyun maven</name>
          <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
      </mirror>
    <mirror>
   
      <id>nexus-aliyun</id>
      <mirrorOf>*,!cloudera</mirrorOf>
      <name>Nexus aliyun</name>                     
      <url>
        http://maven.aliyun.com/nexus/content/groups/public
      </url>
    </mirror>
    <mirror>
            <id>central</id>
            <name>Maven Repository Switchboard</name>
            <url>http://repo1.maven.org/maven2/</url>
            <mirrorOf>central</mirrorOf>
    </mirror>
    <mirror>
        <id>repo2</id>
        <mirrorOf>central</mirrorOf>
        <name>Human Readable Name for this Mirror.</name>
        <url>http://repo2.maven.org/maven2/</url>
    </mirror>
    <mirror>
        <id>ibiblio</id>
        <mirrorOf>central</mirrorOf>
        <name>Human Readable Name for this Mirror.</name>
        <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
    </mirror>
    <mirror>
        <id>jboss-public-repository-group</id>
        <mirrorOf>central</mirrorOf>
        <name>JBoss Public Repository Group</name>
        <url>http://repository.jboss.org/nexus/content/groups/public</url>
    </mirror>
    <mirror>
        <id>google-maven-central</id>
        <name>Google Maven Central</name>
        <url>https://maven-central.storage.googleapis.com
        </url>
        <mirrorOf>central</mirrorOf>
    </mirror>
    <!-- 中央仓库在中国的镜像 -->
    <mirror>
        <id>maven.net.cn</id>
        <name>oneof the central mirrors in china</name>
        <url>http://maven.net.cn/content/groups/public/</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
  </mirrors>

 

 2.修改idea的配置

打开软件

 

 修改maven的相关配置

 

 添加idea的scala插件

 

 

 

 3.新建项目

建项目参考 建项目

注意:如果是cdh版本的集群,在pom.xml中还需要添加cloudera的仓库,放在依赖配置前面即可

 <repositories>
    <repository>
      <id>cloudera</id>
      <url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
    </repository>
  </repositories>

 

新建好依赖下载看网速,如果下载完成后pom.xml报错,建议删掉本地库的相关jar更新pom.xml后重新下载。

在新建scala类时注意

如图,如果在scala下新建scala类时没1,不慌,选中先建2,建一个测试用例,起名为xxx.scala,之后就可以使用1了

 (以前没出现这情况,新版本的idea突然有这个,mmp)

 

posted @ 2018-06-08 17:41  qinglanmei  阅读(421)  评论(0编辑  收藏  举报