使用maven-scm-plugin进行Git更新失败

时间:2018-05-24 12:57:23

标签: git maven maven-scm

我在使用Maven SCM插件从GitLab repo进行代码更新时遇到了一些问题。首先,这是我的带有SCM和插件配置的pom.xml的一部分:

<scm>
    <url>http://path.to.my.repo</url>
    <connection>scm:git:http://path.to.my.repo.git</connection>
   <developerConnection>scm:git:http://path.to.my.repo.git</developerConnection>
</scm>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-scm-plugin</artifactId>
                <version>1.9.5</version>
            </plugin>
        </plugins>
    </pluginManagement>

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-scm-plugin</artifactId>
            <configuration>
                <username>user</username>
                <password>pass</password>
            </configuration>
        </plugin>
    </plugins>
</build>

我设法将我的代码推送到这样的远程仓库:

git init
git add .
mvn -Dmessage="initial commit" scm:checkin

现在,这些是我的问题:

  1. 我在我的工作目录中做了多处更改,但我已经走到了尽头,我需要使用远程仓库中的代码更新我的代码。我尝试使用git add .mvn scm:update,但代码未更新。所有更改的文件都保留在暂存区域中。我在这做错了什么?根据{{​​3}},这应该是正确的方法。基本上我正在寻找相当于git checkout .命令。

  2. 我尝试使用mvn scm:add代替git add .,但我无法弄明白,如何在暂存区域中添加当前目录中的所有文件。

  3. 我已尝试mvn -Dincludes="." scm:add,并说Cannot run add command : Exception while executing SCM command. You must provide at least one file/directory to add

    执行mvn -Dincludes="*" scm:add也会导致错误:[ERROR] The following paths are ignored by one of your .gitignore files: .project Use -f if you really want to add them.我真的不知道为什么此命令要将.project文件添加到暂存区域,因为我已在{{1}中将其排除文件。

    那么使用Maven SCM插件将当前目录中的所有已更改文件添加到暂存区域的正确方法应该是什么(当然不包括.gitignore中的文件?)

    感谢您的建议。

0 个答案:

没有答案
相关问题