Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Buckminster » Maven optional and test dependencies not needed
Maven optional and test dependencies not needed [message #375618] Tue, 11 March 2008 11:11 Go to next message
Kövér Gábor is currently offline Kövér GáborFriend
Messages: 2
Registered: July 2009
Junior Member
Hi!

I try to "Buckminsterize" one of my Eclipse projects that uses dom4j, junit,
log4j and xml-apis. I decided to materialize these jars from a Maven
repository.
Because I have a simple Eclipse project with .project and .classpath I have
created a cspex with dependencies like this (for example to use junit 3.8.2
instead of 4.4):
....
<cs:dependency name="junit" versionDesignator="[3.8,4.0)"
versionType="OSGi"/>
<cs:dependency name="log4j"/>
<cs:dependency name="xml-apis"/>
....
Everything works great until I add dom4j to the dependencies.
ERROR [0003] : No suitable provider for component
stax/stax-ri/[1.0,1.1.0.a)#Triplet was found in searchPath default

(In the http://repo1.maven.org/maven2 repository dom4j has a lot of
dependencies which I don't need, one of them is stax and it seems to have a
bug in the dom4j POM.)

My first questions is: how to tell Buckminster that I do not need those
optional or test scoped dependencies from Maven?

The second question is theoretical: Suppose I have two or more Java projects
that depend on dom4j. How can I tell Buckminster to materialize dom4j in a
common place from where all of the project share the same file? Now I use
the same method as in org.demo.xml.provider and place the jars in a jars
folder of my project.

Best regards,

Gabor
Re: Maven optional and test dependencies not needed [message #375652 is a reply to message #375618] Tue, 11 March 2008 13:51 Go to previous messageGo to next message
Thomas Hallgren is currently offline Thomas HallgrenFriend
Messages: 3240
Registered: July 2009
Senior Member
Kövér Gábor wrote:
> Hi!
>
> I try to "Buckminsterize" one of my Eclipse projects that uses dom4j, junit,
> log4j and xml-apis. I decided to materialize these jars from a Maven
> repository.
> Because I have a simple Eclipse project with .project and .classpath I have
> created a cspex with dependencies like this (for example to use junit 3.8.2
> instead of 4.4):
> ...
> <cs:dependency name="junit" versionDesignator="[3.8,4.0)"
> versionType="OSGi"/>
> <cs:dependency name="log4j"/>
> <cs:dependency name="xml-apis"/>
> ...
> Everything works great until I add dom4j to the dependencies.
> ERROR [0003] : No suitable provider for component
> stax/stax-ri/[1.0,1.1.0.a)#Triplet was found in searchPath default
>
I've seen that too. It's an inconsistency in the maven repo. There's no stax-ri component present in
the stax group.


> (In the http://repo1.maven.org/maven2 repository dom4j has a lot of
> dependencies which I don't need, one of them is stax and it seems to have a
> bug in the dom4j POM.)
>
> My first questions is: how to tell Buckminster that I do not need those
> optional or test scoped dependencies from Maven?
>
You add an advisor node to the CQUERY where you declare that the component should be skipped.


> The second question is theoretical: Suppose I have two or more Java projects
> that depend on dom4j. How can I tell Buckminster to materialize dom4j in a
> common place from where all of the project share the same file? Now I use
> the same method as in org.demo.xml.provider and place the jars in a jars
> folder of my project.
>
Buckminster will only materialize one single copy for the whole resolution. The reason we copy it
into the plug-in project in our demo is that a plug-in must either be self sufficient or depend on
other plug-ins. Common jar files are not plug-ins.

The way to resolve this issue is normally that a common jar is copied into one plug-in and that this
plug-in in turn exports the packages from that common jar. Other plug-ins can then make use of them
through the same classloader.

Regards,
Thomas Hallgren
Re: Maven optional and test dependencies not needed [message #375655 is a reply to message #375652] Tue, 11 March 2008 16:36 Go to previous messageGo to next message
Kövér Gábor is currently offline Kövér GáborFriend
Messages: 2
Registered: July 2009
Junior Member
"Thomas Hallgren" <thomas@tada.se> az al
Re: Maven optional and test dependencies not needed [message #375656 is a reply to message #375655] Tue, 11 March 2008 22:20 Go to previous message
Thomas Hallgren is currently offline Thomas HallgrenFriend
Messages: 3240
Registered: July 2009
Senior Member
Kövér Gábor wrote:
>> You add an advisor node to the CQUERY where you declare that the component
>> should be skipped.
> Thanks for the tip. I'd prefer to put it in the component specification
> instead. I think it is something like prerequisite in Buckminster. (For
> example xalan and xerces only needs for testing but not for compiling and
> running dom4j.)

Buckminster can do this already. You can resolve based on an cspec attribute and "prune" the
resolution to only bring in what's needed in order to satisfy that attribute. You can define actions
or groups that are specific to test, compile, run, etc. and then prune your based on them.

The problem is often that the component specification that controls the dependencies in question are
out of reach. It might be several transitions away from a specification that you can control. Here
you do require dom4j, but you cannot alter the component specification for dom4j. We are
experimenting with "overlays" that would allow such alterations but it's not fully supported at this
point.

> This generates an other question:
> Although Buckminster seems to select the most appropriate version of a
> component, but when there is no single choice it materializes both
> componenst.
> For example for junit [3.8,4.0) and [3.8,3.8.2) results to 3.8.1.
> But for [3.8,4.0) and 4.0 both the 3.8.2 and 4.4 will be selected.
> Is it possible to tell Buckminster that this situarion is prohibited and
> make it an error for me? I do not want duplicate entries on my classpath.
>
To be honest, I thought that was the default behavior :-)

In any case, I can see situations when both approaches would be valid and where it indeed would be
desirable to allow/disallow such duplicates. Please add a bugzilla enhancement request for this.

Regards,
Thomas Hallgren
Previous Topic:Performing an Action Stalls (headless)
Next Topic:Plugin Unit Test Support
Goto Forum:
  


Current Time: Thu Apr 18 19:07:48 GMT 2024

Powered by FUDForum. Page generated in 0.02392 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top