Writing a Maven Plugin/Mojo: how do you make a goal force the execution of other goals? -
note: thread writing custom mojo, not using plugin.
i maintain testing plugin maven. unfortunately, year now, i've let particular unknown linger , i'd know how deal users can have simpler configuration.
let's have 2 goals in our plugin:
prepare
(phase: generate-sources)do
(phase: compile)
i want configure do
mojo require prepare
have been executed in earlier phase of build. however, nothing in descriptor documentation suggests can.
the user doesn't care or understand point of prepare
goal, don't want force them specify in pom. of course, execute mojo directly do
, prepare
goal have run @ later phase intended.
(i looked custom lifecycles, makes appear has prepare
goal in poms have executed twice upon running do
.)
you have below (taken compilermojo):
/** * @author <a href="mailto:jason@maven.org">jason van zyl </a> * @version $id: compilermojo.java 941498 2010-05-05 21:24:11z krosenvold $ * @since 2.0 * @goal compile * @phase compile * @threadsafe * @requiresdependencyresolution compile */
by setting on class, execute during compile phase (in example). compile phase requires previous phases have executed first (validate, generate-sources, process-sources, generate-resources, process-resources
...).
basically, pick phase after 1 need (or same one) , should work.
Comments
Post a Comment