美文网首页程序员工具癖
java开发工具IntelliJ IDEA安装以及使用

java开发工具IntelliJ IDEA安装以及使用

作者: 不惧未来 | 来源:发表于2019-03-03 14:52 被阅读28次

    从事 java 开发工作两年,对 java 的开发工具 IDEA 是最为满意,编辑、编译、UT\CT全部本地搞定。下面简单介绍 IDEA 的安装与使用。

    Step 1: 官网下载 IDEA 软件安装包,选择免费的开源版本,手动安装;

    https://www.jetbrains.com/idea/download/#section=windows

    Step 2:下载 JDK

    用 IDEA 创建 project,要想完成编译必须下载 jDK,并且安装,如安装在以下目录 C:\Program Files\Java\jdk-11.0.1 在IDEA configure 好,可能遇到一系列问题。

    ERROR 1: Connect to repo.maven.apache.org:443
        [ERROR] Plugin org.springframework.boot:spring-boot-maven-plugin:1.5.4.RELEASE or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.springframework.boot:spring-boot-maven-plugin:jar:1.5.4.RELEASE: Could not transfer artifact org.springframework.boot:spring-boot-maven-plugin:pom:1.5.4.RELEASE from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.196.215] failed: Connection timed out: connect -> [Help 1]
        [ERROR] 
        [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
        [ERROR] Re-run Maven using the -X switch to enable full debug logging.
        [ERROR] 
        [ERROR] For more information about the errors and possible solutions, please read the following articles:
        [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
    

    修改 setting.xml 解决:
    打开自己的maven的setting配置文件

    根据 User setting file 提供的路径打开 setting.xml,如果此文件不存在,可以创建一个,内容如下:

    <?xml version="1.0" encoding="UTF-8"?>
    <settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/SETTINGS/1.0.0">
          <proxies>
              <proxy>
                  <id>optional</id>
                  <active>true</active>
                  <protocol>http</protocol>
                  <username>proxyuser</username>
                  <password>proxypass</password>
                  <host>10.144.1.10</host>
                  <port>8080</port>
                  <nonProxyHosts>*.nokia.com</nonProxyHosts>
              </proxy>
          </proxies>
          <servers>
              <server>
                  <id>deploymentRepo</id>
                  <username>anonymous</username>
                  <password>anonymous</password>
              </server>
          </servers>
      </settings>
    

    加入如下节点,保存;

            <mirrors>
                <mirror>
                    <id>osc</id>
                    <mirrorOf>*</mirrorOf>
                    <url>http://maven.oschina.net/content/groups/public/</url>
                </mirror>
            </mirrors>
    

    然后 重新编译,即可成功!如果依旧没有成功,把刚刚添加的 <mirrors>节点内容全部删掉,重新更新maven依赖,然后重新编译,这个问题就没有了。

    ERROR 2: SDK 版本不匹配
    Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project FileSystem: Compilation failure: Compilation failure:
    

    jdk-11.0.1 太新了,卸载掉,安装 jdk-8u92-windows-x64.exe
    根据下面提示的信息中重新设置 JDK

    Maven 3.3.1+ requires JDK 1.7+. Please set appropriate JDK at Settings | Build, Execution, Deployment | Build Tools | Maven | Runner | JRE
    
    ERROR 3:plugin 无法下载

    设置代理,File->Settings->Plugins, 点击Updates右边的符号,选择 Http Proxy Settings

    ERROR 4: SNAPSHOT dependency 的错误
    Failed to execute goal on project Harmonization-API: Could not resolve dependencies for project com.nokia.imp:Harmonization-API:jar:2.0.0-SNAPSHOT: Could not find artifact com.nokia.imp:MappingGenerator-API:jar:2.0.0-SNAPSHOT -> [Help 1]
    

    勾选 SE,如下:

    ERROR 5: svn 下载失败

    https://tortoisesvn.net/downloads.html
    安装的时候注意勾选 command line

    ERROR 6: CMake 问题
    CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set
    

    http://www.cygwin.com/
    下载安装 cygwin

    相关文章

      网友评论

        本文标题:java开发工具IntelliJ IDEA安装以及使用

        本文链接:https://www.haomeiwen.com/subject/hapruqtx.html