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 applications of Maven require the use of artifact variants (i.e. the same version of an artifact built in different ways). Examples are the <a class="confluence-link unresolved" data-content-title="Support+for+other+languages" data-linked-resource-default-alias="Support+for+other+languages" href="#">Native Mojo discussion</a><a class="confluence-link" href="/display/MAVEN/Support+for+other+languages" data-linked-resource-id="37642" data-linked-resource-type="page" data-linked-resource-default-alias="Support for other languages" data-base-url="http://docs.codehaus.org">Support for other languages</a>, which requires different variants for architecture/operating system/system (AOS), etc. Another example is a debug, release or obfuscated build of a jar. I don't think these variants can be defined in advance, because Maven cannot anticipate the possible variants people will want to produce. Also, in native land, a mere AOS will not suffice, since a library can be built with or without zlib/png/jpeg/whatever support. In addition, it should be possible to define alternatives if a variant is missing: If there's no debug build in the repo, Maven should be able to automatically use the normal one, or if there's no library optimized for the core2 processor, Maven should automatically use the i686 version.</p> <p>Therefor this proposal is for Maven to support a generic and flexible variant system, inspired by Gentoo's <a href="http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=2">USE variables</a>. A project would declare a variant section in its pom, specifying what variants are available, e.g.</p> <table class="wysiwyg-macro" data-macro-name="noformat" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e25vZm9ybWF0fQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <variant> <option> <name>arch</name> <description>System architecture</description> <default>i386</default> <optionValues> <optionValue> <value>i386</value> <description>Generic i386 processor</description> </optionValue> <optionValue> <value>i686</value> <description>Generic i686 processor</description> <alternatives>i386</alternatives> </optionValue> </optionsValues> </option> <option> <name>build</name> <description>Build type</description> <optional>true</optional> <optionValues> <optionValue> <value>debug</value> <description>Include debug information</description> </optionValue> <optionValue> <value>obfuscated</value> <description>Obfuscate the code</description> </optionValue> </optionValues> </option> </variant> </pre></td></tr></table> <p>Option names and values should be unique within a project (no option value "debug" can be used in other options than "build" in the example). A project would also specify (e.g. via profiles) which variant is active, on a global and on a per-dependency scale:</p> <table class="wysiwyg-macro" data-macro-name="noformat" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e25vZm9ybWF0fQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <use> <option> <name>arch</name> <value>i686</value> </option> <option> <name>build</name> <value>debug</value> </option> </use> </pre></td></tr></table> <p>When resolving artifacts, Maven checks if all required options are specified, and their values are valid. It then builds a variant specifier ("i686-debug") and uses this to resolve the artifact. I'm not sure if the classifier should be used for this, or if an additional field should be introduced, though. If an optional option <img class="emoticon emoticon-smile" data-emoticon-name="smile" border="0" src="/s/en_GB/3278/15/_/images/icons/emoticons/smile.png" alt="(smile)" title="(smile)" /> is missing, it is omitted from the specifier (i.e. if "build" were unspecified in the example, the variant specifier would be "i686"). Also, if the artifact cannot be found with the variant specifier, maven tries omitting optional options. In the example, if the "i686-debug" variant is not present, we try the "i686" variant. It also tries to use alternatives, so in the example, we would also try "i386-debug" and "i386". There should be a well defined order, of course, in which the variants are tried.</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