当前位置:   article > 正文

idea+Maven+Git使用步骤_idea 配置maven和git详情

idea 配置maven和git详情

接上一篇Maven项目新建

1. 对于新建的Maven项目

第一步File–>Settings里面看一下有没有git.ext

在这里插入图片描述

以下是步骤

  1. 点击VCS–>Import into Version Control–>Create Git Repository–>选择你当前项目的路径–>点击ok,会自动在你的路径下面添加.git文件
    在这里插入图片描述

  2. 项目名称右键–>show in Explorer,查看可以看到新添了.git文件
    在这里插入图片描述
    在这里插入图片描述

  3. 再次点击VCS–>Commit,然后把你要提交的文件选中,写个注释
    在这里插入图片描述
    在这里插入图片描述

  4. 默认是master,在项目右下角Git:master可以改

  5. push项目前新建忽略文件

  6. 我们把项目push到我的Github或者是Gitee账户的仓库上时,有部分文件是不需要的push的

  7. 项目名称右键–>New–>File–>命名.gitignore

  8. 在这里插入图片描述

pom.xml

  1. 在src目录下的.xml文件在项目运行中,不会加载到target中,会导致找不到.xml文件
    将xml文件复制到target的classes目录中,并在查询运行时正确读取
    pom.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.qf</groupId>
    <artifactId>hello-mybatis</artifactId>
    <version>1.0-SNAPSHOT</version>
<!--    导入依赖-->
    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.4.6</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.47</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/log4j/log4j -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

    </dependencies>
<!--  将xml文件复制到classes中,并在查询运行时正确读取  -->
<build>
    <resources>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>*.xml</include>
                <include>**/*.xml</include>
            </includes>
            <filtering>true</filtering>
        </resource>
    </resources>
</build>

</project>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46

VCS–>Git–>push

在这里插入图片描述

  1. 点击Push
    在这里插入图片描述
    在这里插入图片描述
  2. 我的gitee是
    在这里插入图片描述
  3. 复制过去,Push就行了!
  4. 有一个报错
  5. maven路径给错了?
    在这里插入图片描述
  6. 重新去Settings去设置
    在这里插入图片描述
  7. 再次push还是不对
  8. 在terminl窗口中依次输入命令:

git pull

git pull origin master

git pull origin master --allow-unrelated-histories
在这里插入图片描述

  1. 再次push 成功!

日志查看

在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小惠珠哦/article/detail/825113
推荐阅读
相关标签
  

闽ICP备14008679号