Intellij IDEA starts the first SpringBoot project

1. Download maven

Maven is a management tool for java project development, similar to MakeFile in Linux, you need to use Maven to automatically download dependencies when creating SpringBoot, if you don't have maven, it will be red.
Install and configure maven tutorial
Automatically configure maven when creating a new project

pom.xmlAfter the installation is complete, you can add the following code in the project , and try to download the jar package:

    <dependencies>
        <dependency>
            <groupId>net.schmizz</groupId>
            <artifactId>sshj</artifactId>
            <version>0.10.0</version>
        </dependency>
        <dependency>
            <groupId>com.redislabs</groupId>
            <artifactId>spark-redis</artifactId>
            <version>2.4.0</version>
        </dependency>
    </dependencies>

After importing the code, remember to click refresh or download on the right mavensidebar.
After installation, in order to speed up the download, you may also need to make the following configurations:

  1. Enter the following setting->maven->importingcode inVM选项-DarchetypeCatalog=internal -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true
  2. setting->mavenChange the configuration file and Maven home pathto local in
    . If you want to use maven to import more jar packages, you can find them in the central warehouse .
  3. If you find an error when running the project, you can try to add it to the column File ->Settings ->Build, Execution, Deployment ->Compilerinbuild process VM options-Djdk.lang.Process.launchMechanism=vfork

2. Use the module that comes with Intellij IDEA to create a new SpringBoot project

Only the enterprise version of Intellij IDEA can use SpringBoot
SpringBoot Tutorial Extreme Edition
If the download fails during creation, you can try to replace the source with the following dependency if https://start.aliyun.com/
it appears at runtimeorg.junit.jupiter.api不存在pom.xml

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>RELEASE</version>
            <scope>test</scope>
        </dependency>

Or take another blogger's approach

Solution to running error

If it cannot run according to the above reference materials, then there is a high probability that it is a problem with the JDK version, as long as the JDK is replaced, JDK8/JDK1.8it can run successfully

  • How to replace JDK
    1. Click on Intellij IDEA'sFile->Project Structure-> Project->SDK->选择下载一个JDK1.8/JDK8
    2. After downloading, add the bin folder in the JDK file to the environment variable
      insert image description here
    3. Reconfigure the JDK option of the project according to the relevant methods on the Internet
    4. You can also directly use Intellij IDEA to create a new SpringBoot project (version selection JDK1.8, Java8), and then copy the source code into it. I personally recommend this method, because it is fast and simple

3. Successfully run the screenshot

insert image description here
insert image description here
gitee warehouse: https://gitee.com/liang-jiajun2/hello-spring-boot.git

Guess you like

Origin blog.csdn.net/qq_33880925/article/details/127972863