effectiveosgi/maven-archetypes

creating a module project without a parent produces broken pom

Closed this issue · 7 comments

I think it would be useful for this to work.

the only issues are:

  • the dependency on _distro is broken because it's missing
  • the osgi deps have no version

Yes I agree that would be nice, but is it possible for the archetype to generate something different depending on the context in which it is created?

The _distro dependency is really useful if it can be satisfied. And if we always generate the versions on the OSGi dependencies then they will be flagged as redundant when inside a parent project.

yes, I agree that if the archetype could handle the details on a conditional basis that would be ideal. I guess one option for the module would be to fail if there's no parent so that it doesn't produce a broken project?

The archetype contents are basically Velocity templates, so it should be possible to conditionally generate different content. I just don't know how to detect the condition of "we are in an EOSGI parent project" etc and input that to the template. There's also very little documentation on writing archetypes. I will dig around, but please let me know if you find anything.

as I'm thinking about it, it seems the template did realize there was no parent because it never added a parent pom reference... so that at least should indicate it's aware of that scenario already.

Yes the archetype generation does a certain amount of magic for free... linking to the parent, and adding the new module to the <module> list in the parent pom.xml. None of this was coded by me, it seems to be built-in to Maven, so it doesn't help with adding additional smarts to my own template :-S

got it!

Erroneously closed with a stray commit message