jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Signup
Maven 2 & 3
  • Maven 2 & 3
  • MNG-5102

Mixin POM fragments

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Wish Wish
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 2.2.1
  • Fix Version/s: 3.2
  • Component/s: POM
  • Labels:
    None
  • Complexity:
    Intermediate
  • Number of attachments :
    2

Description

I am looking for a way to mixin POM fragments into POMs. Note that this idea is beyond parent pom inheritance because all projects inherit from a corporate parent pom. The problem that I am running into is that the corporate parent pom is turning into an "everything but the kitchen sink" POM and I'd like to dissect it into POM fragments relevant for individual modules.

For example, I would like to have mixins for:

  • Java projects (that include static code analysis plugins, javadoc, etc.)
  • JPA projects (that include DDL generation)
  • Flex projects (that include flexmojos, asdoc, etc.)
  • Scala projects (that include the maven-scala-compiler plugin, scaladoc, etc.)
  • JavaScript projects (that include build plugins like maven-yuicompressor-plugin with jslint and compress goals)

Hopefully, you get the idea. Without the ability to factor pom logic, we are left with two symptoms:

  1. copy/paste duplication
  2. complex "it does it all" parent poms (which slow down builds because more plugins are loaded even though they might not do anything material)

Note that a project may include multiple mixins as I could have a project that contains Java code, Scala code, and JavaScript.

Another idea is that the mixins could be parameterized, so that the ultimate pom can be customized based on the parameters (like tokens).

I recall reading about Mixins coming in Maven 3.1, but could not find any such issue to watch, so am creating one.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Hide
    Zip Archive
    daddy3.zip
    02/Oct/12 3:01 PM
    5 kB
    Tony Lampada
    1. XML File
      daddy/tiles/pom.xml 0.5 kB
    2. XML File
      daddy/tiles/kid-tile/pom.xml 0.9 kB
    3. XML File
      daddy/tiles/girl-tile/pom.xml 0.9 kB
    4. XML File
      daddy/tiles/boy-tile/pom.xml 0.9 kB
    5. XML File
      daddy/pom.xml 0.7 kB
    6. XML File
      daddy/boy/pom.xml 0.6 kB
    7. XML File
      daddy/kid/pom.xml 0.6 kB
    8. Text File
      daddy/README.txt 0.2 kB
    9. XML File
      daddy/girl/pom.xml 0.6 kB
    Download Zip
    Show
    Zip Archive
    daddy3.zip
    02/Oct/12 3:01 PM
    5 kB
    Tony Lampada
  2. Hide
    Zip Archive
    maven-tiles.zip
    24/May/11 3:07 AM
    47 kB
    Maurizio Pillitu
    1. XML File
      maven-tiles/examples/pom.xml 0.7 kB
    2. XML File
      maven-tiles/examples/.../pom.xml 1.0 kB
    3. XML File
      maven-tiles/examples/.../pom.xml 1 kB
    4. XML File
      maven-tiles/examples/.../pom.xml 0.5 kB
    5. XML File
      maven-tiles/examples/.../pom.xml 1 kB
    6. XML File
      maven-tiles/examples/.../pom.xml 0.5 kB
    7. XML File
      maven-tiles/examples/.../pom.xml 2 kB
    8. XML File
      maven-tiles/examples/.../pom.xml 4 kB
    9. Text File
      maven-tiles/examples/.../README.txt 0.6 kB
    10. HTML File
      maven-tiles/examples/.../tile/HomePage.html 2 kB
    11. Java Source File
      maven-tiles/examples/.../tile/HomePage.java 0.5 kB
    12. Java Source File
      maven-tiles/.../WicketApplication.java 0.6 kB
    13. File
      maven-tiles/examples/.../log4j.properties 0.4 kB
    14. PNG File
      maven-tiles/examples/.../webapp/logo.png 12 kB
    15. File
      maven-tiles/examples/.../webapp/style.css 1 kB
    16. XML File
      maven-tiles/examples/.../WEB-INF/web.xml 1 kB
    17. Java Source File
      maven-tiles/examples/.../tile/Start.java 2 kB
    18. Java Source File
      maven-tiles/examples/.../TestHomePage.java 0.5 kB
    19. File
      maven-tiles/examples/.../tile/HomePage.class 1 kB
    20. HTML File
      maven-tiles/examples/.../tile/HomePage.html 2 kB
    21. File
      maven-tiles/.../WicketApplication.class 0.6 kB
    22. File
      maven-tiles/examples/.../log4j.properties 0.4 kB
    23. File
      maven-tiles/examples/.../tile/Start.class 2 kB
    24. File
      maven-tiles/examples/.../TestHomePage.class 1.0 kB
    25. File
      maven-tiles/.../maven-tiles-core.iml 3 kB
    26. XML File
      maven-tiles/.../pom.xml 0.5 kB
    27. Text File
      maven-tiles/.../README.txt 0.7 kB
    28. Java Source File
      maven-tiles/.../TilesMavenLifecycleParticipant.java 5 kB
    29. XML File
      maven-tiles/.../components.xml 0.8 kB
    30. XML File
      maven-tiles/pom.xml 0.7 kB
    Showing 30 of 31 items Download Zip
    Show
    Zip Archive
    maven-tiles.zip
    24/May/11 3:07 AM
    47 kB
    Maurizio Pillitu

Issue Links

relates to

Wish - General wishlist item MNG-5173 Include other XML files from POM

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Brett Porter added a comment - 23/May/11 10:54 PM

yes, surprisingly there doesn't appear to be an issue for it, though lots of related ones. Adding to that version.

Show
Brett Porter added a comment - 23/May/11 10:54 PM yes, surprisingly there doesn't appear to be an issue for it, though lots of related ones. Adding to that version.
Hide
Permalink
Brett Porter added a comment - 23/May/11 11:25 PM

I've been in greater need of this lately - I'll kick a discussion on the development list

Show
Brett Porter added a comment - 23/May/11 11:25 PM I've been in greater need of this lately - I'll kick a discussion on the development list
Hide
Permalink
Maurizio Pillitu added a comment - 24/May/11 3:07 AM

Hi,
I've some code to share - tested on Maven 3.0.2 - which composes a Maven POM from different tiles; it's a spike of 2 days work, but I think results are very interesting.

The implementation consists of:

  • an implementation of MavenLifecycleParticipant.java (120 lines)
  • a components.xml

The attached ZIP file contains a Maven build to produce a JAR that needs to be copied in M2_HOME/lib, a README.txt and a working sample; there are still some issues (e.g. properties inheritance), which are reported in the README, but I think that it gives the idea.

I really hope this could help with this feature implementation.

Show
Maurizio Pillitu added a comment - 24/May/11 3:07 AM Hi, I've some code to share - tested on Maven 3.0.2 - which composes a Maven POM from different tiles; it's a spike of 2 days work, but I think results are very interesting. The implementation consists of: an implementation of MavenLifecycleParticipant.java (120 lines) a components.xml The attached ZIP file contains a Maven build to produce a JAR that needs to be copied in M2_HOME/lib, a README.txt and a working sample; there are still some issues (e.g. properties inheritance), which are reported in the README, but I think that it gives the idea. I really hope this could help with this feature implementation.
Hide
Permalink
Darren Hartford added a comment - 03/Nov/11 8:27 AM

Just to make sure there is an appropriate discussion on other points-of-view: as a consumer of different maven plugins/other projects there are times when each individual plugin/project requires a large amount of configuration within the pom (particularly third-party plugins). If mixin is intended to help mitigate this problem, great, just didn't want to assume without asking

Examples include the maven-gwt-plugin which requires a good amount of configuration, as well as Enunciate. Having those plugins be able to provide example mixin file that only focuses on their particular plugin will avoid a lot of merging problems that usually occur in sometimes very large pom.xml files.

Show
Darren Hartford added a comment - 03/Nov/11 8:27 AM Just to make sure there is an appropriate discussion on other points-of-view: as a consumer of different maven plugins/other projects there are times when each individual plugin/project requires a large amount of configuration within the pom (particularly third-party plugins). If mixin is intended to help mitigate this problem, great, just didn't want to assume without asking Examples include the maven-gwt-plugin which requires a good amount of configuration, as well as Enunciate. Having those plugins be able to provide example mixin file that only focuses on their particular plugin will avoid a lot of merging problems that usually occur in sometimes very large pom.xml files.
Hide
Permalink
Tony Lampada added a comment - 01/Aug/12 11:15 AM

Maurizio, your maven-tiles seems very promising.

Do you still use it today?
Have you made any improvements to it?
By using it, have you bumped into new problems that you haven't thought of?
How about making it into a github project, or something?

Show
Tony Lampada added a comment - 01/Aug/12 11:15 AM Maurizio, your maven-tiles seems very promising. Do you still use it today? Have you made any improvements to it? By using it, have you bumped into new problems that you haven't thought of? How about making it into a github project, or something?
Hide
Permalink
Paul Benedict added a comment - 01/Aug/12 1:32 PM - edited

Use "import" scope; that's how you can define a POM for particular types of projects (see issue description) and then add those dependencies to your project. I would say the "import" scope is the Mixin you want.

http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

Show
Paul Benedict added a comment - 01/Aug/12 1:32 PM - edited Use "import" scope; that's how you can define a POM for particular types of projects (see issue description) and then add those dependencies to your project. I would say the "import" scope is the Mixin you want. http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
Hide
Permalink
Maurizio Pillitu added a comment - 01/Aug/12 1:40 PM

@Tony

  • Yes, I still use it sometimes, but being a customisation on the Maven distro (and not a plugin) it is really hard to distribute and build collaboration around it
  • No improvements have been made so far
  • As above, no changes were made, but probably the biggest issue right now is find a way to implement it as a Maven plugin
  • I'm in, will create a github project in the weekend

@Paul, the Mixin feature aims to inherit <build> behaviours, not (only) dependencies. Read more here http://stackoverflow.com/questions/2456375/how-to-use-maven-3-mixins

Show
Maurizio Pillitu added a comment - 01/Aug/12 1:40 PM @Tony Yes, I still use it sometimes, but being a customisation on the Maven distro (and not a plugin) it is really hard to distribute and build collaboration around it No improvements have been made so far As above, no changes were made, but probably the biggest issue right now is find a way to implement it as a Maven plugin I'm in, will create a github project in the weekend @Paul, the Mixin feature aims to inherit <build> behaviours, not (only) dependencies. Read more here http://stackoverflow.com/questions/2456375/how-to-use-maven-3-mixins
Hide
Permalink
Tony Lampada added a comment - 01/Aug/12 2:11 PM

Dunno.
IMO, import scope was a very important step for maven as it is a move towards the "favor composition over inheritance" design principle for poms.
However that limits using composition for project dependencies.

There's nothing that import scopes can do for me if I want to make a reusable piece of build behaviour, like for example, using the maven-dependency-plugin to unpack a few dependencies during the proccess-resources phase.

Please see

  • MNG-5127
  • http://stackoverflow.com/questions/11749375/import-maven-plugin-configuration-by-composition-rather-than-inheritance-can-it
  • http://stackoverflow.com/questions/10245621/how-to-inherit-from-a-multimodule-maven-project-with-all-its-goodies
Show
Tony Lampada added a comment - 01/Aug/12 2:11 PM Dunno. IMO, import scope was a very important step for maven as it is a move towards the "favor composition over inheritance" design principle for poms. However that limits using composition for project dependencies. There's nothing that import scopes can do for me if I want to make a reusable piece of build behaviour , like for example, using the maven-dependency-plugin to unpack a few dependencies during the proccess-resources phase. Please see MNG-5127 http://stackoverflow.com/questions/11749375/import-maven-plugin-configuration-by-composition-rather-than-inheritance-can-it http://stackoverflow.com/questions/10245621/how-to-inherit-from-a-multimodule-maven-project-with-all-its-goodies
Hide
Permalink
Tony Lampada added a comment - 02/Oct/12 3:05 PM

Now that maven-tiles has been successfully packed as an open source project,
I made a small project that demonstrates how, using maven-tiles, one can get the desired mixin behaviour.

See attached daddy3.zip

Thanks Maurizio!

Show
Tony Lampada added a comment - 02/Oct/12 3:05 PM Now that maven-tiles has been successfully packed as an open source project , I made a small project that demonstrates how, using maven-tiles, one can get the desired mixin behaviour. See attached daddy3.zip Thanks Maurizio!

People

  • Assignee:
    Unassigned
    Reporter:
    Anthony Whitford
Vote (37)
Watch (32)

Dates

  • Created:
    23/May/11 9:18 PM
    Updated:
    22/Oct/12 3:22 PM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.