1

マルチモジュールmavenプロジェクトのモジュール間で多数のリソースを共有するためにmaven-remote-resources-pluginを使用しようとしています。残念ながら、おそらくフィルタリングによって、バンドル中に共有バイナリ リソースが破損しています。

ローカル リポジトリから共有リソース jar を抽出すると、破損したバイナリ ファイルが含まれているため、この段階で破損が発生していると確信しています。

maven-remote-resources-plugin のフィルタリングをオフにするものはありますか?

現時点では、共有リソース モジュールの pom は次のようになっています

<build>
  <plugins>
    <plugin>
       <artifactId>maven-remote-resources-plugin</artifactId>
       <executions>
         <execution>
           <goals>
             <goal>bundle</goal>
           </goals>
         </execution>
       </executions>
       <configuration>
         <includes>
           <include>**/*</include>
         </includes>
       </configuration>
     </plugin>
  </plugins>
</build>

<dependencies>
  <dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-remote-resources-plugin</artifactId>
    <version>1.3</version>
  </dependency>
</dependencies>
4

3 に答える 3

5

バンドル中にリソースが破損しているようです。リソース プロジェクトは単なる jar であるためresources、デフォルトのライフサイクルの一部としてプラグインを実行します。これをリソース プロジェクトの POM に追加してみてください。

<plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.6</version>
    <executions>
      <execution>
        <id>default-resources</id>
        <configuration>
          <nonFilteredFileExtensions>
            <nonFilteredFileExtension>exe</nonFilteredFileExtension>
            <nonFilteredFileExtension>dontFilterMeEither</nonFilteredFileExtension>
          </nonFilteredFileExtensions>
          [...]
        </configuration>
      </execution>
    </executions>
  </plugin>

ドキュメントには、デフォルトでフィルタリングされないバイナリ ファイルが記載されています。上記の構成は、拡張機能をリストに追加します。

于 2012-10-02T13:44:40.550 に答える
0

試しましたか :

<plugin>
        <artifactId>maven-remote-resources-plugin</artifactId>
        <version>1.3</version>
        <executions>
          <execution>
            <id>process-remote-resources</id>
            <goals>
              <goal>process</goal>
            </goals>
            <configuration>
              <useDefaultFilterDelimiters>false</useDefaultFilterDelimiters>
              [...]
            </configuration>
          </execution>
        </executions>
      </plugin>
于 2012-10-02T11:44:09.963 に答える
0

これを解決するために私たちが取ったアプローチは以下のとおりです。
注 user944849 の回答を誤解していたため、テストしていませんが、機能する可能性があります。

共有リソース pom の resources 句を使用して、ローカル リポジトリに直接 jar を作成しました。これは maven-resources-plugin (?) を使用していると思います。

次に、maven-dependency-plugin を使用して一時ディレクトリに解凍し、resource-consumer pom の resources 句内で目的のリソースをフィルタリングしました。

共有リソース

<build>
  <resources>
    <resource>
      <directory>src/main/resources</directory>
      <filtering>false</filtering>
      <includes>
        <include>**/*</include>
      </includes>
    </resource>
  </resources>
</build>

リソース消費者

<build>
  <resources>
    <resource>
      <directory>${project.build.directory}/shared-resources</directory>
      <includes>
        <include>theOnlyOneIWant.properties</include>
      </includes>
    </resource>
  </resources>
  [...]
  <plugins>
    <plugin>
      <artifactId>maven-dependency-plugin</artifactId>
      <version>2.5</version>
      <executions>
        <execution>
          <id>shared-resources</id>
          <goals>
            <goal>unpack-dependencies</goal>
          </goal>
          <phase>generate-resources</phase>
          <configuration>
            <includeGroupIds>myProjectGroup</includeGroupIds>
            <includeArtifactIds>myProjectSharedResources</includeArtifactIds>
            <outputDirectory>${project.build.directory}/shared-resources</outputDirectory>
          </configuration>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

これは、maven-remote-resources-plugin を使用できるすべてのインスタンスで機能するとは限りませんが、私たちにとっては機能しており、バイナリ リソースの破損の問題を解決しています。

于 2012-10-04T00:40:13.570 に答える