Solved :)

So for all to see if that can help someone else. Here is some modified jelly code extracted from the maven-shell plugin :

<!-- Get all maven goals -->
<j:set var="mavenSession" value="${context.getMavenSession()}"/>
<j:set var="allGoals" value="${mavenSession.getAllGoalNames()}"/>
<j:new var="modList" className="java.util.ArrayList"/>
<j:set var="dummy" value="${modList.addAll(allGoals)}"/>
<!-- Sort them -->
<j:invokeStatic method="sort" className="java.util.Collections" var="dummy">
<j:arg type="java.util.List" value="${modList}" />
</j:invokeStatic>
<!-- Print them for me to see -->
<j:forEach var="goal" items="${modList.iterator()}">
<echo>goal: ${goal}</echo>
</j:forEach>


context is a quite nice bean, once you know it exists in the first place.
On the subject, is there anywhere we can look to get a list of all "build-in" beans that exists and that we can use in our code?


Eric.

Eric Giguere wrote:

Hi all

A quick one, is there a way using jelly scripting to check for the existance of a goal in a project or a plugin?

Some context information... Lets say I'm building a plugin that acts a little like the xdoc plugin, that is based on registration from either other plugins or projects. At some point, the "generic plugin" will call a goal in those that registered with the plugin. But what if I want to include in the generic plugin some placeholder code that can be executed if the registree doesn't provide specific functionnality? In xdoc context, that would mean providing some jelly code for a report plugin that doen't provide the report goal. Right now, if we call a non existing goal, we'll have a build failure, and that's perfectly normal. But it would be nice to check for the goal existance before calling it.

Any idea on how to do this, if its possible in the first place?

thx
Eric.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to