Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for maven-tiles; trying out <extensions>true</extensions> and multiple entries inside <configuration> by @talios #82

Closed
paulvi opened this issue Apr 17, 2016 · 13 comments

Comments

@paulvi
Copy link
Contributor

paulvi commented Apr 17, 2016

maven-tiles https://github.com/repaint-io/maven-tiles allows to have parts of build definition in separate files. Having part of build in parts can enable quicker adoption of polyglot thinking,
and skip problem of having to translate parts, e.g. when find an example of plugin configuration.

Possibly this issue should sound like "support translating parts of pom"

ref repaint-io/maven-tiles#61

@jvanzyl
Copy link
Contributor

jvanzyl commented Apr 17, 2016

This is really the parameterized mixin and isn't just a polyglot issue, and it should just work transparently. I'm not keen on support any functionality model-wise that is not supported in Maven itself.

@jvanzyl jvanzyl closed this as completed Apr 17, 2016
@paulvi
Copy link
Contributor Author

paulvi commented Apr 18, 2016

@jvanzyl Jason, it is not about just you and your time.

Both projects are great effort for extending Maven. Is it "only we are great", or "let's look what great can come out of these things put together".

Or maybe you can point to an alternative that is already in use..

@mkristian
Copy link
Contributor

@paulvi with ruby and groovy you can easily achieve such mixins. feels like just pick the right flavor of poms then you get "tiles" for free.

@jvanzyl
Copy link
Contributor

jvanzyl commented Apr 18, 2016

All I'm saying is that I'm not adding support for any specific plugin implementation. If there's a general problem sure that needs to be fixed.

@talios
Copy link

talios commented Apr 19, 2016

I did some quick experimentation on a fresh empty project with a simple tile definition. @jvanzyl whilst not a tile specific issue, I think there is a problem here with polyglot-maven itself ( or more, the model readers/writers ) in relation to MOJO configuration - which from memory is represented as just a DOM node - and essentially no-mands-land when it comes to the different formats.

The simple project has this plugin defined:

  <plugin>
    <groupId>io.repaint.maven</groupId>
    <artifactId>tiles-maven-plugin</artifactId>
    <version>2.8</version>
    <extensions>true</extensions>
    <configuration>
      <tiles>
        <tile>com.smxemail.tiles:com.smxemail.tiles.release:[2.0.0,3.0.0)</tile>
        <tile>com.smxemail.tiles:com.smxemail.tiles.enforcements:[2.0.0,3.0.0)</tile>
        <tile>com.smxemail.tiles:com.smxemail.tiles.osgiservices:[2.0.0,3.0.0)</tile>
        <tile>com.smxemail.tiles:com.smxemail.tiles.karaffeature:[2.0.0,3.0.0)</tile>
      </tiles>
    </configuration>
  </plugin>

The atom format converts this to:

plugin
  id: io.repaint.maven:tiles-maven-plugin:2.8
  tiles: [
    tile: "com.smxemail.tiles:com.smxemail.tiles.release:[2.0.0,3.0.0)"
    tile: "com.smxemail.tiles:com.smxemail.tiles.enforcements:[2.0.0,3.0.0)"
    tile: "com.smxemail.tiles:com.smxemail.tiles.osgiservices:[2.0.0,3.0.0)"
    tile: "com.smxemail.tiles:com.smxemail.tiles.karaffeature:[2.0.0,3.0.0)"
  ]

This correctly pulls out each <tile> from the configuration, but fails to do anything with <extensions>true</extensions>, whilst the yaml format returns:

  - groupId: io.repaint.maven
    artifactId: tiles-maven-plugin
    version: 2.8
    extensions: true
    configuration:
      tiles: {tile: 'com.smxemail.tiles:com.smxemail.tiles.karaffeature:[2.0.0,3.0.0)'}

which does pull out the extensions, but only keeps the last <tile> definition.

The ruby version:

  plugin( 'io.repaint.maven:tiles-maven-plugin:2.8',
      'tiles' => [ 'com.smxemail.tiles:com.smxemail.tiles.release:[2.0.0,3.0.0)',
                   'com.smxemail.tiles:com.smxemail.tiles.enforcements:[2.0.0,3.0.0)',
                   'com.smxemail.tiles:com.smxemail.tiles.osgiservices:[2.0.0,3.0.0)',
                   'com.smxemail.tiles:com.smxemail.tiles.karaffeature:[2.0.0,3.0.0)' ] )

gets all the tile definitions, but also skips the execution.

Groovy gets it all correct:

  plugin {
    groupId 'io.repaint.maven'
    artifactId 'tiles-maven-plugin'
    version '2.8'
    extensions 'true'
    configuration {
      tiles {
        tile 'com.smxemail.tiles:com.smxemail.tiles.release:[2.0.0,3.0.0)'
        tile 'com.smxemail.tiles:com.smxemail.tiles.enforcements:[2.0.0,3.0.0)'
        tile 'com.smxemail.tiles:com.smxemail.tiles.osgiservices:[2.0.0,3.0.0)'
        tile 'com.smxemail.tiles:com.smxemail.tiles.karaffeature:[2.0.0,3.0.0)'
      }
    }
  }

and the scala variant just NPEs.

I just tried adding the atom extension to the project and added the missing extensions: true bit, but tiles never seemed to kick in so it might not even be reading it. The ruby extension just seemed to explode with a lot of internal ruby looking errors. Groovy however worked a charm!

$ mvn -f pom.groovy clean install
[INFO] Scanning for projects...
[INFO] --- tiles-maven-plugin: Injecting 4 tiles as intermediary parent artifact's...
[INFO] Mixed 'com.talios.test:polyglot-tiles:1.0-SNAPSHOT' with tile 'com.smxemail.tiles:com.smxemail.tiles.release:2.0.8' as it's new parent.
[INFO] Mixed 'com.smxemail.tiles:com.smxemail.tiles.release:2.0.8' with tile 'com.smxemail.tiles:com.smxemail.tiles.enforcements:2.0.4' as it's new parent.
[INFO] Mixed 'com.smxemail.tiles:com.smxemail.tiles.enforcements:2.0.4' with tile 'com.smxemail.tiles:com.smxemail.tiles.osgiservices:2.0.1' as it's new parent.
[INFO] Mixed 'com.smxemail.tiles:com.smxemail.tiles.osgiservices:2.0.1' with tile 'com.smxemail.tiles:com.smxemail.tiles.karaffeature:2.0.1' as it's new parent.
[INFO] Mixed 'com.smxemail.tiles:com.smxemail.tiles.karaffeature:2.0.1' with original parent '(no parent)' as it's  new top level parent.

Assuming these things get fixed ( we should raise them as independent, not related to tiles issues tho ) then I don't see any reason for the other variants to not just work as well.

@rvowles
Copy link

rvowles commented Apr 19, 2016

@talios you are hitting an issue with yaml itself there, it cannot handle more than one key named the same thing in the same "hash". Ansible suffers greatly from this.

@paulvi
Copy link
Contributor Author

paulvi commented Apr 19, 2016

Now I am 100% sure who wrote README at https://github.com/repaint-io/maven-tiles

@talios, hint: add - [ ] that would be converted to checkbox, and the result will be even visible from issue list

@paulvi paulvi changed the title Support for maven-tiles Support for maven-tiles; trying out <extensions>true</extensions> and multiple entries inside <configuration> by @talios Apr 19, 2016
@mkristian
Copy link
Contributor

@paulvi I assume you did convert the xml into the various pom DSL? if yes, will fix the ruby bits.

but the conversion from the internal model DOM into some pom representation does not indicate that the DSL is broken. I am sure

plugin( 'io.repaint.maven:tiles-maven-plugin:2.8',
      :extensions => true,
      'tiles' => [ 'com.smxemail.tiles:com.smxemail.tiles.release:[2.0.0,3.0.0)',
                   'com.smxemail.tiles:com.smxemail.tiles.enforcements:[2.0.0,3.0.0)',
                   'com.smxemail.tiles:com.smxemail.tiles.osgiservices:[2.0.0,3.0.0)',
                   'com.smxemail.tiles:com.smxemail.tiles.karaffeature:[2.0.0,3.0.0)' ] )

will work as expected.

@paulvi
Copy link
Contributor Author

paulvi commented Apr 19, 2016

@talios DONE, all issues as separate tickets #62, #86, #87, #88

@mkristian Christian, the trying out and comparison #82 (comment) is made by @talios Mark , not me. I have not decided on flavor, was betting on YAML, but now it looks that only Groovy is bug free for now.

@mkristian
Copy link
Contributor

@paulvi sorry - wrong pick :)

@mkristian
Copy link
Contributor

and thanx for splitting this up

@paulvi
Copy link
Contributor Author

paulvi commented Apr 19, 2016

@mkristian for #82 (comment)

with ruby and groovy you can easily achieve such mixins. feels like just pick the right flavor of poms then you get "tiles" for free.

nothing is for free. There is Babylon Tower problem #15 when developers used different languages and cannot freely reuse them.

And maven-tiles idea allows to gradually transit to a flavor or mix them (Note: I still have to try out well repaint-io/maven-tiles#62)

@talios
Copy link

talios commented Apr 19, 2016

@mkristian That was me who added those examples, and yes - I was using the converter tool to generate the different flavours, so they're not writing out the extensions element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants