Может ли maven-shade-plugin создать затененный pom для модуля с pom типа упаковки? - PullRequest
1 голос
/ 03 марта 2011

У меня есть многомодульный проект maven с отдельным модулем xyz-distribution, который содержит несколько сборок. Этот модуль зависит от всех артефактов, которые входят в сборки.

В моем родительском модуле я отключил развертывание по умолчанию, так как хочу, чтобы развертывались только мои дистрибутивные сборки.

Поскольку в моем производственном репозитории не будет отдельных артефактов (только дистрибутивные сборки), развернутый дистрибутив также не должен перечислять никаких зависимостей. Я попытался достичь этой цели, включив 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

Есть идеи, как решить мою проблему?

родительский пом (упрощенно):

<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>
...