创建一个Maven项目

创建我的第一个Maven项目

一、new project(选择Maven),点击next

 

 

二、GroupId(公司域名),ArtifactId(项目名),点击next

三、项目名,项目所在位置,点击finish

 

四、pom.xml中配置依赖(mybatis,mysql),Maven不会自动把.xml文件打包,所以用build配置

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.ychs</groupId>
    <artifactId>homework</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <!--mybatis-->
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.5.0</version>
        </dependency>
        <!--mysql-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.49</version>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
    </build>

</project>

 

 

 



posted @ 2021-05-16 17:17  若你  阅读(278)  评论(0编辑  收藏  举报