Trouble with project imports / maven dependencies

373 views
Skip to first unread message

Scott Siebers

unread,
Jul 13, 2015, 12:31:05 PM7/13/15
to drools...@googlegroups.com
We recently started evaluating Drools / Workbench for a project I'm working on, and have been quite impressed with how far the web UI has come since the 5.X releases.  One thing I'm having problems with however is getting project dependencies / imports working between artifacts stored in separate repositories.  To give some background on my use case, we want to configure the system with separate users/groups having their own private repositories (sort of a multi-tenant setup), but leveraging a shared set of core object model assets that each user can build their own unique rule sets around.  I've been able able to configure Organization Unit security tied to user roles to achieve the desired isolation of repositories, and I'm hoping to use Maven dependencies between projects such that the user building the core objects can deploy a JAR with the object models, and other users can just add a dependency on that jar to pull them in and use in their rules.  So in a more general sense:

1) User A creates Project B stored in private Repo C
2) User A deploys Project B to Maven repository
3) User X creates Project Y (which depends on Project B) in private repo Repo Z

Following the analogy above, I've been able to complete steps 1 and 2 and successfully deployed Project B to both the local maven repo that's part of workbench, as well as to an external maven repo via <DistributionManagement> section of the POM. When I then switch over to  User X and to work on Project Y, it seems unable actually make use of Project B.  I've added the dependency on B (tried both manually in the POM, and via "Add from repository" in the workbench UI as suggested in [1]), and I can build and deploy Y just fine without any rule assets in it.  But when I go to actually author rules that use objects from Project B, the web UI can’t see those types.  If I try to add an import suggest in Project Y to pull an object from Project B, upon build I get an error stating that “Definition of class <class name> was not found.  Please check the necessary external dependencies for this project are configured correctly.”  And if I create a guided rule in Project Y, when I use the “config” view to add imports the only thing it can see is java.lang.Number, but none of the types from B.  Any idea why it wouldn’t resolve the Maven dependencies between projects when it's declared in the POM and the artifacts are in the local repo?  Do projects have to be in the same repository for the Workbench UI to be able to resolve their dependencies?  This would seem counter to the design of using Maven to declare project dependencies so I'm hoping this isn't the case but can't seem to 

If it helps, this is all currently running on the 6.3.0.Beta1 code release in a Tomcat7 container. 

Thanks!

Michael Anstis

unread,
Jul 14, 2015, 6:06:23 AM7/14/15
to drools...@googlegroups.com
It sure should work,

Does Project Y define any repositories in it's pom.xml? i.e. the Workbench repository, otherwise Maven will only try to resolve from .m2 (is Project B present there on the server?)

--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/5052bc0b-78ab-42e1-a36e-cadcbca341a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Scott Siebers

unread,
Jul 14, 2015, 6:25:40 PM7/14/15
to drools...@googlegroups.com
Yes, Project B is present both in the workbench local repository (viewable in the workbench "Artifact Repository view) as well as published to a remote snapshot repo.  I've tried to build Project Y both with and without a <repositories> section in the pom pointing at the snapshot repo.  Either way it doesn't work.  

One other point of reference, I am using the "org.guvnor.m2repo.dir" and "kie.maven.settings.custom" system properties to point specify the location of my local workbench repo and associated maven settings with credentials to the remote repo, but these seem to be working fine by virtue of the fact that I can deploy Project B to local and remote maven repos just fine.

Michael Anstis

unread,
Jul 14, 2015, 6:29:20 PM7/14/15
to drools...@googlegroups.com

Ok, does Project B reference any classes that might be in a *provided* scope dependency or is it just POJOs?

On 14 Jul 2015 23:25, "Scott Siebers" <s.si...@gmail.com> wrote:
Yes, Project B is present both in the workbench local repository (viewable in the workbench "Artifact Repository view) as well as published to a remote snapshot repo.  I've tried to build Project Y both with and without a <repositories> section in the pom pointing at the snapshot repo.  Either way it doesn't work.  

One other point of reference, I am using the "org.guvnor.m2repo.dir" and "kie.maven.settings.custom" system properties to point specify the location of my local workbench repo and associated maven settings with credentials to the remote repo, but these seem to be working fine by virtue of the fact that I can deploy Project B to local and remote maven repos just fine.

--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.

Scott Siebers

unread,
Jul 15, 2015, 11:40:03 PM7/15/15
to drools...@googlegroups.com
Nope.  Project B is just a couple of simple test Data Objects created with the workbench with no outside dependencies.  Each object has a few String / Numeric / Date fields but that's about it.  

Michael Anstis

unread,
Jul 31, 2015, 7:00:13 AM7/31/15
to drools...@googlegroups.com
Hi Scott,

Sorry it's taken so long to get to look at this.

Is it possible you could detail your configuration so I can investigate? I tried to figure it out from your email but want to be sure I'm looking at something equivalent to your set up.

e.g. example ProjectB and ProjectY pom's, settings.xml, values of "org.guvnor.m2repo.dir" and "kie.maven.settings.custom" etc

Thanks,

Mike

On 16 July 2015 at 04:40, Scott Siebers <s.si...@gmail.com> wrote:
Nope.  Project B is just a couple of simple test Data Objects created with the workbench with no outside dependencies.  Each object has a few String / Numeric / Date fields but that's about it.  

--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages