开发者

Can the maven-shade-plugin create a shaded pom for a module with packaging type pom?

I have a multi module maven project with a seperate xyz-distribution module that contains multiple assemblies. This module depends on all artifacts that go into the assemblies.

In my parent pom I have disabled deployment per default as I want only my distribution assemblies deployed.

Since there will be no individual artifacts in my production repository (only the distribution assemblies), the deployed distribution pom should also not list any dependencies. I tried to achieve this goal by including the maven-shade-plugin in my configuration.

But calling 'mvn install' always yields the following error

[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

Any ideas how to solve my problem?

parent pom (simplified):

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

distribution 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开发者_如何学C>

      <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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜