repaint-io / maven-tiles

Injecting maven configurations by composition rather than inheritance
154 stars 32 forks source link

Tiles not imported when groupId or version is not defined #11

Closed xfr-dev closed 9 years ago

xfr-dev commented 10 years ago

When using a parent, groupId and version can be missing in a child module if this module has the same parent pom value for this attributes. But when using tiles plugin, this feature doesn't work because of this code (src/main/groovy/io/repaint/maven/tiles/TilesMavenLifecycleParticipant.groovy @ line 296) :

                if (model.artifactId == project.artifactId && model.groupId == project.groupId
                        && model.version == project.version && model.packaging == project.packaging) {
                    injectTilesIntoParentStructure(tiles, model, request)
                }

The workaround is obviously to redefine groupId and version in the child module but this isn't documented (or i missed it?) and no log are emitted making very difficult to kown why tile doesn't work.

rvowles commented 10 years ago

Mmmmmm

We need a method to detect that model being requested is this model. I think we can fix this by checking something like:

sameVersion ==> (model.version == project.version || (!model.version && model.parent?.version == project.version))

and the same with the group id.

That would make it work?

I don't use projects with no versions and rarely with no groupIds, so this is unfamiliar ground.

xfr-dev commented 10 years ago

I don't know if this solution would work but if you integrate it into a snapshot version of the plugin, i can test it.

reevesy commented 9 years ago

Hi Great plugin, your effort is appreciated. I'm also facing this issue and also willing to test. This would be a handy feature for us as eclipse almost encourages you to remove the groupId with the warning 'GroupId is duplicate of parent groupId' _ I'm currently fixing up our projects with a comment above groupId saying don't remove this or maven titles will fail

rrialq commented 9 years ago

Hi, nice plugin. I've just do a pull request, to solve this issue.