maven-shade-plugin可以为包装类型为pom的模块创建阴影pom吗?

时间:2011-03-03 07:16:20

标签: maven maven-assembly-plugin

我有一个多模块maven项目,它包含一个包含多个程序集的单独xyz-distribution模块。此模块依赖于进入程序集的所有工件。

在我的父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>
分发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>
  <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>

0 个答案:

没有答案
相关问题