[rules-users] Data Model Dependencies in Guvnor

Stephen Masters stephen.masters at me.com
Fri Sep 14 06:09:51 EDT 2012


As with any Java app, a Jar's dependencies need to be on the classpath. Uploading a POJO model to Guvnor doesn't put it on the class path, so it needs to encapsulate all its dependencies.

I would recommend setting your build up so that it produces both POJO models (assuming you actually need both). It's really easy! At least this way, if your build compiles, then you know that the POJO Jars are valid.

Alternatives:

Extend the base model using declarative facts. I haven't played around with this, but I think it should work. Although it could get messy mixing up POJO and declarative facts in this manner.

Traits are intended for some of this kind of thing, although they're very recent. Davide blogged about them here: 
http://planet.jboss.org/post/new_feature_spotlight_traits_part_1

Put dependencies in your server lib directory, which would do the trick, but which IMO is a bloomin' awful idea. It's a maintenance PITA, as you need to restart the server every time you update the base model.

Steve


On 13 Sep 2012, at 17:20, dme1 <mehtad at hotmail.com> wrote:

> Hi,
> 
> I have created 2 projects in Eclipse - the first one is the Base Project
> with the Model defined for this as BaseModel.jar. The send one is the
> Extension Project which inherits the BaseModel and extends it, this Model is
> called ExtendedModel.jar.
> 
> In Eclipse I can set the dependency on BaseModel in the Extended Project and
> can write rules using the Base and Extended Models.
> 
> Now I create 2  packages in Guvnor one to represent the Base Project, the
> second to represent the Extended Project. I upload the BaseModel to the
> BaseProject and the associated technical rules and this all works well.
> 
> In the Extended Package I upload the "BaseModel.jar" successfully, however
> when I try to upload the "ExtendedModel.jar" it gives me an Error. The only
> way I can resolve my error is to update the ExtendedModel.jar to include all
> classes from BaseModel.jar, so it seems like the Guvnor requires all
> dependencies to be resolved within the Model jar and cannot reference other
> Data Models within the same package.
> 
> Is there a way for Guvnor to lookup the other Models for dependencies and
> resolve the dependencies? If not what is the recommended approach for
> specifying dependent models in Guvnor?
> 
> Thanks,
> dme
> 
> 
> 
> --
> View this message in context: http://drools.46999.n3.nabble.com/Data-Model-Dependencies-in-Guvnor-tp4019750.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120914/7cd44382/attachment.html 


More information about the rules-users mailing list