Git update failed using maven-scm-plugin

674 Views Asked by At

I've got a couple of problems with code update from GitLab repo using Maven SCM plugin. First, here's a part of my pom.xml with SCM and plugin configuration:

<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>

I've managed to push my code to remote repo like this:

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

Now, these are my questions:

  1. I've done multiple changes in my working directory, but I've come to a dead end and I need to update my code with the one from remote repo. I've tried with git add . and mvn scm:update but the code is not updated. All changed files stay in a staging area. What am I doing wrong here? According to documentation this should be the right way. Basically I'm looking for an equivalent of git checkout . command.

  2. I've tried using mvn scm:add instead of git add ., but I just can't figure it out, how to add all files from current directory in a staging area.

I've tried mvn -Dincludes="." scm:add and it says Cannot run add command : Exception while executing SCM command. You must provide at least one file/directory to add.

Executing mvn -Dincludes="*" scm:add also causes error: [ERROR] The following paths are ignored by one of your .gitignore files: .project Use -f if you really want to add them. I don't really know why this command wants to add .project file to staging area since I've exclude it in .gitignore file.

So what should be the right way to add all changed files from current directory to a staging area using Maven SCM plugin (without excluded files from .gitignore, of course)?

Thank you for your suggestions.

0

There are 0 best solutions below