Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Dashboard
Maven User
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<p>Many Mojos (e.g. the compiler) execute in different phases of the build lifecycle using different "configurations". With the current JavaDoc and MNG-2521 annotations, a Mojo cannot be annotated with more than one goal. Multiple "configurations" are done by subclassing a Mojo for each "configuration", e.g. CompilerMojo and TestCompilerMojo, which are virtually identical except parameter annotations and attribute names. With MNG-2521, the proposal is to extend the annotations to allow a Mojo to be annotated with multiple goals.</p> <p>For this, list annotations should be introduced for each annotation (Goal, Parameter and Component). Each member of the list should have an optional attribute specifying for which goal the annotation is. If this attribute is missing, the annotation should be valid for all goals.</p> <p>Example for a CompilerMojo</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> @Goals( @Goal(goal = "compile", phase = "compile", requiresDependencyResolution = "compile"), @Goal(goal = "testCompile", phase = "test-compile", requiresDependencyResolution = "test")) public class CompilerMojo extends AbstractMojo { @Parameter(expression = "${basedir}", required = true, readonly = true) // Valid for all goals private File basedir; @Parameters( @Parameter(goal = "compile", expression = "${project.compileSourceRoots}"), // Valid only for goal "compile" @Parameter(goal = "testCompile", expression = "${project.testCompileSourceRoots}")) // Valid only for goal "testCompile" private List compileSourceRoots; } </pre></td></tr></table> <p>Saves two classes and some typing.</p> <p>When a parameter needs to have different names for different goals (e.g. "includes" and "testIncludes"), you can use setters:</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> private List includes; @Parameter(goal = "compile), // Valid only for goal "compile" public void setIncludes(List includes) { this.includes = includes; } @Parameter(goal = "testCompile")) // Valid only for goal "testCompile" public void setTestIncludes(List includes) { this.includes = includes; } </pre></td></tr></table> <p>On the long run, it would be nice to decouple a parameter name from the underlying attribute or method name, and allow the parameter name to be specified in the annotation.</p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced