1

複数のアセンブリを含む個別の xyz-distribution モジュールを使用したマルチモジュール Maven プロジェクトがあります。このモジュールは、アセンブリに入るすべての成果物に依存します。

私の親 pom では、配布アセンブリのみを展開したいので、デフォルトで展開を無効にしました。

本番リポジトリには個々のアーティファクトは存在しないため (配布アセンブリのみ)、デプロイされた配布 pom にも依存関係がリストされないようにする必要があります。構成に maven-shade-plugin を含めることで、この目標を達成しようとしました。

ただし、「mvn install」を呼び出すと、常に次のエラーが発生します

[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing null with C:\...\xyz-distribution\target\xyz-distribution-1.0-shaded.pom
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error creating shaded jar: null

私の問題を解決する方法はありますか?

親 pom (簡略化):

<project 
    xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
                        http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>x.y.z</groupId>
  <artifactId>xyz-parent</artifactId>
  <version>1.0</version>
  <packaging>pom</packaging>

  <build>
     <plugins>
       <plugin>
         <inherited>true</inherited>
         <artifactId>maven-deploy-plugin</artifactId>
         <configuration>
           <skip>true</skip>
         </configuration>
       </plugin>
     </plugins>
   </build>
 </project>

配布ポン:

<project 
    xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
                        http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>x.y.z</groupId>
    <artifactId>xyz-parent</artifactId>
    <version>1.0</version>
  </parent>
  <artifactId>xyz-distribution</artifactId>
  <packaging>pom</packaging>

  <dependencies>
    <!-- assembly descriptors will reference this dependencies -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>xyz-api</artifactId>
      <version>${project.version}</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>distro-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>src/assemble/bin.xml</descriptor>
                <descriptor>src/assemble/doc.xml</descriptor>
                <descriptor>src/assemble/src.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <artifactSet>
                <includes>
                  <include>*</include>
                </includes>
              </artifactSet>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <configuration>
          <skip>false</skip>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
4

0 に答える 0