Overriding the site plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Overriding the site plugin

Mark Raynsford
Hello.

When one types "mvn site", it seems that the site plugin that's included
with the local Maven install is executed (which then runs all of the
reports and so on).

Is it possible to override this plugin (in other words, replace it with
something else) on a per-project basis?

Basically, I'd like to type "mvn site" and get my own plugin instead of
the existing maven-site-plugin.

--
Mark Raynsford | http://www.io7m.com


attachment0 (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Overriding the site plugin

Russell Gold-3
Have you tried adding the desired maven-site-plugin (with version) as a project dependency?

> On Oct 15, 2017, at 12:54 PM, Mark Raynsford <[hidden email]> wrote:
>
> Hello.
>
> When one types "mvn site", it seems that the site plugin that's included
> with the local Maven install is executed (which then runs all of the
> reports and so on).
>
> Is it possible to override this plugin (in other words, replace it with
> something else) on a per-project basis?
>
> Basically, I'd like to type "mvn site" and get my own plugin instead of
> the existing maven-site-plugin.
>
> --
> Mark Raynsford | http://www.io7m.com
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Overriding the site plugin

Mark Raynsford
In reply to this post by Mark Raynsford
On 2017-10-15T16:54:15 +0000
Mark Raynsford <[hidden email]> wrote:
>
> Basically, I'd like to type "mvn site" and get my own plugin instead of
> the existing maven-site-plugin.

Er, to clarify, I mean that I'd like to execute a new plugin entirely,
not just a different version of the maven-site-plugin. I realized after
I sent the message that it could be interpreted more than one way...

--
Mark Raynsford | http://www.io7m.com


attachment0 (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Overriding the site plugin

Mark Raynsford
On 2017-10-15T17:02:19 +0000
Mark Raynsford <[hidden email]> wrote:
>
> Er, to clarify, I mean that I'd like to execute a new plugin entirely,
> not just a different version of the maven-site-plugin. I realized after
> I sent the message that it could be interpreted more than one way...

Managed to answer my own question. It turns out that I want to disable
an existing binding of a plugin to a lifecycle phase, and then run my
own plugin after that. As an example:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.6</version>
        <executions>
          <execution>
            <id>default-site</id>
            <phase>none</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clean-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <id>default-site</id>
            <goals>
              <goal>clean</goal>
            </goals>
            <phase>site</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

This would disable the execution of the maven-site-plugin by setting
phase to "none", and then run the maven-clean-plugin instead. I just
use the maven-clean-plugin as an example, it'd obviously work with any
other plugin.

--
Mark Raynsford | http://www.io7m.com


attachment0 (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Overriding the site plugin

Hervé BOUTEMY
you found it

I'll just add a reference documentation on default lifecycles and plugins/
goals binding:
http://maven.apache.org/ref/current/maven-core/lifecycles.html

Regards,

Hervé

Le dimanche 15 octobre 2017, 18:08:31 CEST Mark Raynsford a écrit :

> On 2017-10-15T17:02:19 +0000
>
> Mark Raynsford <[hidden email]> wrote:
> > Er, to clarify, I mean that I'd like to execute a new plugin entirely,
> > not just a different version of the maven-site-plugin. I realized after
> > I sent the message that it could be interpreted more than one way...
>
> Managed to answer my own question. It turns out that I want to disable
> an existing binding of a plugin to a lifecycle phase, and then run my
> own plugin after that. As an example:
>
>   <build>
>     <plugins>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-site-plugin</artifactId>
>         <version>3.6</version>
>         <executions>
>           <execution>
>             <id>default-site</id>
>             <phase>none</phase>
>           </execution>
>         </executions>
>       </plugin>
>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-clean-plugin</artifactId>
>         <version>3.0.0</version>
>         <executions>
>           <execution>
>             <id>default-site</id>
>             <goals>
>               <goal>clean</goal>
>             </goals>
>             <phase>site</phase>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>
>
> This would disable the execution of the maven-site-plugin by setting
> phase to "none", and then run the maven-clean-plugin instead. I just
> use the maven-clean-plugin as an example, it'd obviously work with any
> other plugin.



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]