Maven shade plugin is not called automatically for goal “package”

前端 未结 1 926
旧巷少年郎
旧巷少年郎 2020-12-11 01:21

I\'ve spent quite a bit of time figuring out how to invoke Maven shade plugin to build a uber-jar (with all dependencies). Most of the google-able info that I found (includi

相关标签:
1条回答
  • 2020-12-11 02:00

    I have managed to reproduce your problem. In your pom.xml, you must have defined plugin like below,

    <build>
    <pluginManagement>
      <plugins>
    
        <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-shade-plugin</artifactId>
           <version>2.4.3</version>
           <executions>
           <execution>
                <phase>package</phase>
                <goals>
                 <goal>shade</goal>
                </goals>
           </execution>
          </executions>
       </plugin>
       ....
    
      </plugins>
    </pluginManagement>
    </build>
    

    instead of

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

    This will probably fix your problem.

    0 讨论(0)
提交回复
热议问题