Question

I was trying to figure out how mixins are defined in Maven 3, but couldn't find anything other than buzz. It is propagated as one of the big new features here and here. I am currently feeling the pain of the hierarchical structure and would like to give it a spin. Does anyone have a pointer to documentation or the source defining the syntax even?

Was it helpful?

Solution

In a comment to this answer, Brett Porter wrote:

Maven 3.0 doesn't offer mixins yet, however. – Brett Porter Feb 16 at 8:18

And AFAIK, mixins still aren't there.

OTHER TIPS

Jesse Glick pointed to Maven issue 5102, so I just wanted to mention that the most recent comment there (2 Oct 2012) links to a new maven plugin that offers mixin behavior: maven-tiles. This seems to be the best option until mixin support is actually baked into Maven (something that has been delayed for several years now).

Edit 2015-Jan: tknerr pointed out that this issue has been flagged for review for Maven 4 inclusion. The Maven devs seem to believe that POM format changes are required to support this feature correctly. (As a long-time Maven user, I'm not surprised by this.)

You can use open-source plugins to introduce mixin into your pom.

There are several plugins which tackle the hierarchy complexity in form of mixin. One of them is designed to solved the hierarchy in plugin / plugin management section.

It reads all the imported POM files and merge them to the POM file in the same manner Maven calculates the effective-pom. The plugin merges only the build, properties and profiles sections and does not merge any other elements of the pom such as dependencies, repositories, etc…

In the below snippet, the artifact sample-mixin will consume the plugin management configuration as defined in the sample-mixin pom file. No need to inherit any parent /base pom for this..

<plugin>
  <groupId>com.github.odavid.maven.plugins</groupId>
  <artifactId>mixin-maven-plugin</artifactId>
  <version>0.1-alpha-23</version>
  <extensions>true</extensions>
  <configuration>
    <mixins>
      <mixin>
        <groupId>mixin-example</groupId>
        <artifactId>sample-mixin</artifactId>
        <version>${project.version}</version>
      </mixin>
    </mixins>
  </configuration>
</plugin>

For further reading, check it out: http://rethinkingswd.blogspot.co.il/2014/09/mixin-maven-plugin-reusable-project.html

Mixins are currently scheduled for Maven 3.2 as bug MNG-5102. They are among many highly voted bugs that have not been addressed in the candidate Maven 3.1.

So much for "Paving the desire lines".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top