1

パッチを適用する必要がある依存関係がいくつかあります。現在、端末から次のことを行っています(ubuntuを実行しています)

patch -R -p1 <Myfolder/Tests/mypatch.patch

指定した作業ディレクトリから。これをMavenでのビルドの一部として実行したいと思います。私は試しました(ここでxmlで「<」を指定する方法に基づいて:XMLドキュメントでエスケープする必要がある文字は何ですか?):

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.2.1</version>
        <executions>
            <execution>
                <id>apply-patch</id>
                <phase>initialize</phase>
                <goals>
                    <goal>exec</goal>
                </goals>
                <configuration>
                    <executable>patch</executable>
                    <workingDirectory>../../wdir</workingDirectory>
                    <arguments>
                        <argument>R</argument>
                        <argument>p1</argument>
                        <argument>&lt;Myfolder/Tests/mypatch.patch</argument>
                    </arguments>
                </configuration>
            </execution>                    
        </executions>
    </plugin>

しかし、それは失敗します:

[INFO] --- exec-maven-plugin:1.2.1:exec (apply-patch) @ my-project ---
patch: '<Myfolder/Tests/mypatch.patch': extra operand
patch: Try `patch --help' for more information.

何か案は?

編集:代わりにオプション -i を試しました:

<execution>
    <id>apply-patch</id>
    <phase>initialize</phase>
    <goals>
        <goal>exec</goal>
    </goals>
    <configuration>
        <executable>patch</executable>
        <workingDirectory>target/tmp</workingDirectory>                         
        <arguments>
            <argument>R</argument>
            <argument>p1</argument>
                <argument>i</argument>                              
                <argument>mypatch.patch</argument>
        </arguments>
    </configuration>
</execution>

しかし、それはエラーを与えます:

[INFO] --- exec-maven-plugin:1.2.1:exec (apply-patch) @ my-project ---
patch: i: extra operand
patch: Try `patch --help' for more information.

ここでそれが可能であるようです:

http://security-automation-content-repository.googlecode.com/svn-history/r242/branches/new-shredder/eXist-db/pom.xml

だから私が見逃しているのはほんの些細なことだと思います。何かアイデアはありますか?

4

2 に答える 2

0

exec プラグインからストリームのリダイレクトを行うことはできないと思いますが、から読み取る代わりに、入力ファイルを指定patchする-iオプションを渡すことができます。patchstdin

patchマンページから

-i patchfile または --input=patchfile patchfile
からパッチを読み取ります。patchfile が - の場合、標準入力から読み取ります (デフォルト)。

于 2013-08-18T01:13:37.277 に答える