1

親プロジェクトといくつかの子プロジェクトがあります。子供の中には、お互いに依存関係を持っている人もいます。例: 親 - > 子 1、親 -> 子 2、子 1 -> 子 2 (子 1 は子 2 に依存)

  <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-shade-plugin</artifactId>
      <version>2.3</version>
  </plugin>
        <plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>maven-clover2-plugin</artifactId>
    <version>3.1.10.1</version>
    <configuration>
      <jdk>${compile.source}</jdk>
      <generateHtml>true</generateHtml>
      <generatePdf>false</generatePdf>
      <generateXml>true</generateXml>
    </configuration>
    <executions>
      <execution>
        <phase>pre-site</phase>
        <goals>
          <goal>instrument</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
  <reportPlugins>
              <plugin>
          <groupId>com.atlassian.maven.plugins</groupId>
          <artifactId>maven-clover2-plugin</artifactId>
          <version>3.1.10.1</version>
          <configuration>
            <jdk>${compile.source}</jdk>
            <generateHtml>true</generateHtml>
            <generatePdf>false</generatePdf>
            <generateXml>true</generateXml>
          </configuration>
        </plugin>
  </reportPlugins>

子ポンは次のようになります。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <executions>
      <execution>
        <phase>package</phase>
        <goals>
          <goal>shade</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <createDependencyReducedPom>false</createDependencyReducedPom>
      <filters>
        <filter>
          <artifact>*:*</artifact>
          <excludes>
            <exclude>META-INF/*.SF</exclude>
            <exclude>META-INF/*.DSA</exclude>
            <exclude>META-INF/*.RSA</exclude>
            <exclude>META-INF/LICENSE</exclude>
            <exclude>config.properties</exclude>
          </excludes>
        </filter>
      </filters>
      <transformers>
        <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
          <mainClass>com.cerner.pophealth.program.runtime.pipeline.Main</mainClass>
        </transformer>
      </transformers>
    </configuration>
  </plugin>

mvm site-deploy が次のエラーで失敗するという問題に直面しています:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:1.7.1:shade (default) on project foo: Error creating shaded jar: error in opening zip file /foo/bar/target/classes -> [Help 1]

mvn site-deploy は foo-parent レベルから実行されます。

サイトが実行されているときでも、clover が target/clover/ フォルダー内に影付きの jar を作成しようとすることに気付きました。

どんな助けでも大歓迎です。

4

2 に答える 2

0

maven-clover2-plugin には、ソース コードの計測に使用できる 2 つの目標があります。

clover2:instrumentゴールは、ソースを計測するために、Maven で並列ビルド ライフサイクルをフォークします。これは、ソース ルート ( src/main/javasrc/test/javaなど) と出力フォルダー ( target/classesなど) がtarget/cloverディレクトリにリダイレクトされることを意味します。このようなフォルダーのリダイレクトは、実行中の他の Maven プラグインに問題を引き起こす場合があります。

clover2 :setupゴールは、Maven のデフォルトのビルド ライフ サイクルでコード インストルメンテーションを実行します。つまり、出力フォルダーは変更されません (たとえば、インストルメント化されたクラスはtarget/classesに配置されます)。

clover2:instrument の目標ではなく、clover2:setup を試すことをお勧めします。ただし、「clover2:setup」を「mvn install」または「mvn deploy」と一緒に呼び出すと、インストルメント化されたバージョンの JAR がインストールされることに注意してください。これが望ましいアクションでない限り、

于 2014-10-07T20:11:55.597 に答える
0

プロファイルを使用してシェーディング プラグインを有効/無効にしました。

   <profiles>
<profile>
  <id>shade</id>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</profile>

于 2014-09-29T21:12:11.977 に答える