Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用使用ssh代理的maven进行git克隆?_Git_Maven - Fatal编程技术网

如何使用使用ssh代理的maven进行git克隆?

如何使用使用ssh代理的maven进行git克隆?,git,maven,Git,Maven,我想用maven克隆一个存储库,身份验证必须使用现有的ssh代理 我当前的插件配置: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-scm-plugin</artifactId> <version>1.9.4</version> <configuration>

我想用maven克隆一个存储库,身份验证必须使用现有的ssh代理

我当前的插件配置:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-scm-plugin</artifactId>
    <version>1.9.4</version>
    <configuration>
        <providerImplementations>
                <git>jgit</git>
        </providerImplementations>
    </configuration>
    <dependencies>
        <dependency>
                <groupId>org.apache.maven.scm</groupId>
                <artifactId>maven-scm-provider-jgit</artifactId>
                <version>1.9.4</version>
        </dependency>
    </dependencies>
    <executions>
        <execution>
            <id>clone-github-wiki</id>
            <goals>
                <goal>checkout</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
                <checkoutDirectory>${project.basedir}/target/github-wiki</checkoutDirectory>
                <connectionType>connection</connectionType>
                <connectionUrl>scm:git:git@github.com:xyz/abc.wiki.git</connectionUrl>
            </configuration>
        </execution>
    </executions>
</plugin>

exec插件可用于调用git命令。在这种情况下,将使用ssh代理

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.3.2</version>
    <executions>
        <execution>
            <id>github-wiki-clone</id>
            <goals>
                <goal>exec</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
                <executable>git</executable>
                <arguments>
                    <argument>clone</argument>
                    <argument>-b</argument>
                    <argument>master</argument>
                    <argument>git@github.com:abc/xyz.wiki.git</argument>
                    <argument>target/github-wiki</argument>
                </arguments>
            </configuration>
        </execution>
    </executions>
</plugin>

org.codehaus.mojo
execmaven插件
1.3.2
github wiki克隆
执行官
产生资源
吉特
克隆
-b
主人
git@github.com:abc/xyz.wiki.git
目标/githubwiki

如果文件夹不是空的,是否可以跳过此执行?
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.3.2</version>
    <executions>
        <execution>
            <id>github-wiki-clone</id>
            <goals>
                <goal>exec</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
                <executable>git</executable>
                <arguments>
                    <argument>clone</argument>
                    <argument>-b</argument>
                    <argument>master</argument>
                    <argument>git@github.com:abc/xyz.wiki.git</argument>
                    <argument>target/github-wiki</argument>
                </arguments>
            </configuration>
        </execution>
    </executions>
</plugin>