日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無先后,達者為師

網(wǎng)站首頁 編程語言 正文

eclipse創(chuàng)建maven項目

作者:.我非賊船 更新時間: 2022-10-14 編程語言

文章目錄

  • Eclipse創(chuàng)建maven項目
  • Eclipse創(chuàng)建springboot項目先下載插件

Eclipse創(chuàng)建maven項目

  1. file > new > other 選擇maven project 下一步

在這里插入圖片描述
2.修改路徑

在這里插入圖片描述

  1. 選擇相關(guān)的項目文件org.apache.maven.achetypes maven-archetype-quickstart1.1文件

在這里插入圖片描述

  1. 修改項目名稱,點擊finish

在這里插入圖片描述

  1. 在resoures里面創(chuàng)建application.properties文件并配置
#語法介紹
## 1.YML 有層級效果.相同的key可以復(fù)用
## 2.YML 配置文件注意縮進
## 3.YML 配置文件支持中文 字符集編碼UTF-8
## 4.YML 數(shù)據(jù)結(jié)構(gòu) key:空格value

#配置端口號
server:
  port: 8091

#管理數(shù)據(jù)源
spring:
  datasource:
    #高版本驅(qū)動使用
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/jt?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true
    #設(shè)定用戶名和密碼
    username: root
    password: root

#SpringBoot整合Mybatis-plus
mybatis-plus:
  #指定別名包
  type-aliases-package: com.jt.pojo
  #掃描指定路徑下的映射文件
  mapper-locations: classpath:/mappers/*.xml
  #開啟駝峰映射
  configuration:
    map-underscore-to-camel-case: true
  # 一二級緩存默認開始 所以可以簡化

#打印mysql日志
logging:
  level:
    com.jt.mapper: debug
  1. 修改pom.xml文件
<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>com.iwcoo</groupId>
  <artifactId>adminpro</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>
  <name>adminpro</name>
  <url>http://maven.apache.org</url>

<!-- SpringBoot相關(guān)jar包 -->
   <parent>
  	<groupId>org.springframework.boot</groupId>
  	<artifactId>spring-boot-starter-parent</artifactId>
  	<version>2.0.5.RELEASE</version>
  </parent> 

<dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    
    <!-- SpringBoot核心jar包 -->
  	<dependency>
  		<groupId>org.springframework.boot</groupId>
  		<artifactId>spring-boot-starter</artifactId>
  	</dependency>
  	<!-- web開發(fā)包:包括了tomca和springmvc -->
  	<dependency>
  		<groupId>org.springframework.boot</groupId>
  		<artifactId>spring-boot-starter-web</artifactId>
  	</dependency>
<!-- springboot熱部署 -->
    <dependency>
    	<groupId>org.springframework.boot</groupId>
    	<artifactId>spring-boot-devtools</artifactId>
    </dependency>
<!-- Thymeleaf  -->
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-thymeleaf</artifactId>
	</dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        

        <!--mybatis依賴包-->
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.2.0</version>
        </dependency> 

        <!--spring整合mybatis-plus -->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.4.3</version>
        </dependency>

        <!--jdbc依賴包-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>

        <!--添加lombok的包-->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>
                <!-- 加入jedis依賴 -->
        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <version>2.9.0</version>
        </dependency>
        <!--這里就是redis的核心jar包-->
		<dependency> 
    		<groupId>org.springframework.boot</groupId>
    		<artifactId>spring-boot-starter-data-redis</artifactId>
		</dependency>
		<!-- 緩存連接池-->
		<dependency>
    		<groupId>org.apache.commons</groupId> 
    		<artifactId>commons-pool2</artifactId>
		</dependency>
 
		<!-- redis 存儲 json序列化 -->
		<dependency>
    		<groupId>com.fasterxml.jackson.core</groupId>
    		<artifactId>jackson-databind</artifactId>
		</dependency>
		<dependency>
    		<groupId>com.fasterxml.jackson.datatype</groupId>
    		<artifactId>jackson-datatype-jsr310</artifactId>
		</dependency>
		    
  </dependencies>
  
  <build>
    <plugins>
    		<plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                  <jvmArguments>
                    -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
                  </jvmArguments>
                </configuration>
			</plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.3.7.RELEASE</version>
                <configuration>
                    <mainClass>com.iwcoo.App</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <id>repackage</id>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
  </build>
</project>
  1. 更新maven
    右鍵項目,點擊maven > update project

Eclipse創(chuàng)建springboot項目先下載插件

Help > Eclipse Marketplace > 搜索 sts
在這里插入圖片描述

下載,等插件安裝完成后重啟eclipse生效

file > new > other 搜索 springboot 開始創(chuàng)建項目

原文鏈接:https://blog.csdn.net/weixin_45102029/article/details/127285788

欄目分類
最近更新