Can we add a maven plugin without tying its target to a specific phase?

Hi I'm new to Maven. I am wondering how I can use the plugin without tying its target to a specific phase. So, for example, I want to use a shade plugin to create an uber-jar (fat gang).

Goal overview

The Shade Plugin has a single goal:

      

hue: the hue is tied to the phase of the batch and is used to create a shaded jar.

So the plugin only has one object named shade

.

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

      

So I said "Hey Maven". I want to bind a shadow to a plugin shade

to your lifecycle package

. Ok, but what if I remove the runtime configuration. What's next, can Maven figure out where to target the shadow? Does each plugin provide its own goals to a predefined one from its creation phase? And how to understand what this phase is?

The documentation description above states that the target is related to the package phase. Does this mean that my execution configuration is redundant?

+3


source to share


1 answer


OK, but what if I remove the run configuration. What's next, can Maven figure out where to put the shadow target?

If you remove the run configuration, the plugin will not run

Does each plugin provide its own goals to a predefined one from its creation phase?

Each target can have a default phase. Therefore, even if no phase is specified and a default phase is specified, the target will be executed at this point in the build cycle.

And how to understand what this phase is?



This is usually stated in the plugin documentation

The above documentation description states that the target is related to the packing phase. Does this mean that my runtime configuration is redundant?

The phase will repeat in your configuration.

See https://maven.apache.org/guides/mini/guide-configuring-plugins.html#Using_the_executions_Tag for details .

+2


source







All Articles