I have a rough draft of this new goal up on github. It turned out a bit
different than I originally expected in that instead of:
<defaultBundlesVersion>6-SNAPSHOT</defaultBundlesVersion>
You use:
<defaultBundles>
<version>6-SNAPSHOT</version>
</defaultBundles>
This is actually pretty close to what Bertrand suggested (sorry for
doubting you...). The nice thing is that this element is entirely
optional. For both base, defaultBundles, and web support (i.e. pax-web),
there are reasonable defaults. And if you want to override the version,
you *only* have to override the version, not the groupId or artifactId.
Here are the poms, post modification:
http://github.com/justinedelson/sling/tree/init-package-maven/launchpad/app/pom.xml
http://github.com/justinedelson/sling/tree/init-package-maven/launchpad/webapp/pom.xml
http://github.com/justinedelson/sling/tree/init-package-maven/launchpad/testing/pom.xml
Here's the mojo class:
http://github.com/justinedelson/sling/blob/init-package-maven/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/projectsupport/InitPackageMojo.java
Comments?
Justin
Felix Meschberger wrote:
Hi Justin,
Interestingly, I was just some days ago thinking about such a plugin
while trying to merge the launchpad/app and launchpad/webapp projects
into the launchpad/bundles project.
I think, if we can create a plugin, which can be configured to include
some bundles and package them up to create a webapp and a standalone app
in a single project, this would probably help alot.
Will post a prototype project descriptor of my app/webapp/bundles merge
exercise tomorrow.
Definitely +1 to do such a plugin.
Can you give it a try ?
Regards
Felix
Justin Edelson schrieb:
I saw some activity regarding the creation of some Maven archetypes for
Sling projects. Before going down that path, I'd like to suggest enhancing
the maven-sling-plugin with a new goal which will handle much of the
configuration being done now via the maven-dependency-plugin. Specifically,
I think the following can be done inside a single goal:
* Unpacking the org.apache.sling.launchpad.bundles assembly in the correct
location.
* Placing the base JAR file in the correct location
* Adding additional bundles to the start level-based directory name
The most significant benefit of doing this is to dramatically simplify the
pom files. The dependency plugin plus the org.apache.sling.launchpad.bundles
dependency takes up about 80 LOC (more once/if my patch for SLING-1179 is
committed) and I think this can be reduced to around 20. This is also
obviously less error-prone.
The other benefit is to reduce the (already proven to be error-prone)
duplication of the launchpad.base version in the pom. I'm proposing that
this new goal in the sling Maven plugin extract the base version from the
dependency list.
I imagine that this goal would use the packaging type to automatically
adjust to the differences in building a standalone app vs. a webapp (i.e.
automatically include pax-web in standalone mode and felix-bridge in webapp
mode).
You can see a brief sample of what I'm describing here:
http://gist.github.com/233240
Thoughts?
Justin