赞
踩
选中 Spring Initializr -> Project Sdk -> Next
第一步点击next之后,如下图,最重要的是type,需要选择Maven,要based project的,不要创建pom.xml的,然后jdk这个可以调整可以不调整,主要看你自己有什么jdk包,还有就是调整包名(package)之类的,看个人需要,这些后续都能调整。最后再点击Next。
3. 项目依赖配置
第二步点击Next之后,到这一步骤,可以直接选择Next,后续需要什么依赖再通过pom文件进行导入即可
4. 项目路径配置
最后配置项目的路径即可,点击Next
新建项目的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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.6.5</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.jzs</groupId> <artifactId>log</artifactId> <version>0.0.1-SNAPSHOT</version> <name>log-demo1</name> <description>single demo about log</description> <properties> <java.version>8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.6.5</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.jz</groupId> <artifactId>all-demo</artifactId> <version>0.0.1-SNAPSHOT</version> <name>all-demo</name> <description>Demo project for Spring Boot</description> <modules> <module>module1</module> <module>module2</module> </modules> <properties> <java.version>8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.jz</groupId> <artifactId>all-demo</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> <groupId>com.jz</groupId> <artifactId>all-demo</artifactId> <version>0.0.1-SNAPSHOT</version> <name>all-demo-module1</name> <description>Demo project for Spring Boot</description> <properties> <java.version>8</java.version> </properties> <dependencies> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
以上就是通过idea创建一个Java的简易项目框架,像分布式项目等也只是基于以上的流程,然后在依赖配置中增加所需的依赖和相关的配置而已,本质上是一样的创建方式。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。