0

maven-2 を使用して、プロジェクトのターゲット フォルダー (特に target/abc_project/META-INF フォルダー) の特定の場所にビルド情報ファイルを作成したいと考えています。

以下は、私が pom.xml で行っていることです

<build>
    <finalName>abc_project</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>

        <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
 <execution>
  <phase>package</phase>
  <id>buid-info-generator</id>
  <goals>
   <goal>exec</goal>
  </goals>
  <configuration>
  <executable>java</executable>
   <arguments>
    <argument>-jar</argument>
    <argument>xyz.jar</argument>
    <argument>target/abc_project/META-INF/info.txt</argument>
    <argument>date</argument>
    <argument>hg summary</argument>
   </arguments>
  </configuration>
 </execution>
</executions>

    </plugins>
</build>

phase以外をinstall, deploy指定すると、次のエラーが発生します-

[INFO] Exception in thread "main" java.io.FileNotFoundException: target\abc_project\META-INF\info.txt (The system cannot find the path specified)
[INFO]  at java.io.FileOutputStream.open(Native Method)
[INFO]  at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
[INFO]  at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
[INFO]  at java.io.FileWriter.<init>(FileWriter.java:73)
[INFO]  at com.nbec.svn.build.info.BuildInfoGenerator.main(BuildInfoGenerator.java:30)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Result of cmd.exe /X /C "java -jar xyz.jar target/abc_project/META-INF/info.txt "date "hg summary"" execution is: '1'.

しかし奇妙なことに、同じコードが 1 つのプロジェクトで機能し、他の 2 つのプロジェクトでは機能しません。同じものを入手するための代替手段はありますか。

4

1 に答える 1

0

実際、エラー レポートは、ディレクトリtarget\abc_project\META-INFがおそらく存在しないことを示しています。これ以上の情報がなければ、私は推測することしかできません。おそらく、abc_project\META-INFディレクトリを作成するプラグインはexec-maven-plugin.

于 2010-09-06T09:16:07.257 に答える