Home » Archived » Buckminster » plugin jar dependencies
plugin jar dependencies [message #524378] |
Wed, 31 March 2010 13:37  |
Eclipse User |
|
|
|
Hi,
I have a plugin that depends on certain jars, in current build these jars are copied over from svn location. How can I copy these jars to my plugin during materialization?
thanks,
Alex
|
|
| | | | | |
Re: plugin jar dependencies [message #524798 is a reply to message #524793] |
Fri, 02 April 2010 10:56   |
Eclipse User |
|
|
|
Hi Alex,
please see comments inline.
Alex schrieb:
> Hi Johannes,
>
> I have couple of questions about the snippet.
>
>
> <dependency name="org.eclipse.equinox.common" componentType="osgi.bundle"/>
> ..
> ..
> <cs:attribute name="bundle.jar" component="org.eclipse.equinox.common"/>
>
>
> Does this mean that org.eclipse.equinox.common has some dependencies,
> and later on they are listed in prerequisites element?
No, it was just an example of an extra dependency of your bundle. You
can replace org.eclipse.equinox.common with foo.jar if you want.
> From the ant script that is being called by fetch.dependency.jars, I
> don't see where it is specified where these jars are being copied from?
That's the good part: The ant script doesn't need to know. Everything
you stated as prerequisite of the 'fetch.dependency.jars action (or
however you would like to call it) will be copied by that script.
> Lastly, if I am not mistaken the fetching will happen during the build
> when all appropriate actions are called. What if I want the fetching
> happen when materialization happens in IDE into my workspace?
>
In the example I declared a public action fetch.dependency.jars and
defined a group buckminster.prebind that contains the action.
buckminster.prebind will be automatically executed when the
materialization occurs, so this is exactly the behaviour you describe.
You resolve your query/mspec, and before buckminster binds your material
to the workspace it will execute the fetch.dependency.jars action and
copy the jars you stated as prerequistes to a folder inside the bundle
(lib in the given example)
Best regards,
Johannes
|
|
| | | | | | | | | | | | | |
Re: plugin jar dependencies [message #540596 is a reply to message #540573] |
Wed, 16 June 2010 11:40   |
Eclipse User |
|
|
|
Hi Alex
please see comments inline.
> My jars are exactly that - non-OSGi jars such as axis.jar,
> commons-logging-1.1.1.jar, etc. So then prebind is what I need in my
> case? But if
> Quote:
>> The cspec extension does not contain a prebind declaration
>
>
> Then where and how is it used?
>
I think you misunderstand. A CSPEX CAN contain an action/group called
buckminster.prebind and this action will be executed before the bundle
is bound to the workspace. Your CSPEX (http://pastebin.com/X5LyeHnF)
however, does NOT contain such action/group and hence, NO action is
executed before the bundle is bound to the workspace. So far all you do
is state some extra dependencies, but what's missing is the declariation
of a prebind action that will actually do something (like copy those
dependencies into your bundle).
Specificily what's missing in your CSPEX is the rest of the example I
posted earlier:
<actions>
<!-- one public action with an ant actor to do the actual
copying -->
<cs:public name="fetch.dependency.jars" actor="ant">
<cs:actorProperties>
<cs:property key="buildFile" value="build/copyJars.xml"/>
<cs:property key="targets" value="copy"/>
</cs:actorProperties>
<cs:prerequisites alias="copyJars.prerequisites">
<!--insert all the extra jars you need here -->
<cs:attribute name="java.binaries" component="com.google.collect"/>
<cs:attribute name="bundle.jar"
component="org.eclipse.equinox.common"/>
</actions>
<groups>
<!-- the prebind group will be executed during materialization -->
<cs:private name="buckminster.prebind" >
<cs:attribute name="fetch.dependency.jars"
alias="action.requirements"/>
</cs:private>
</groups>
And the matching ant script:
<project name="BuckminstersLittleHelperAntScript" basedir=".."
default="copy">
<target name="copy">
<buckminster.copy todir="lib">
<!-- fs:copyJars.prerequisites contains all the stuff
declared in the cspex -->
<buckminster.filesetgroup value="${fs:copyJars.prerequisites}" >
</buckminster.filesetgroup>
</buckminster.copy>
</target>
</project>
> Quote:
>> Turning all jars into bundles is the preferred approach.
>
>
> Do you mean each jar should be a separate bundle?
>
Yes, that is usually the prefered approach in an OSGi environment. All
jars are OSGi bundles. There's also some repositories available that
offer OSGiified versions of many common java libs. Eclipse Orbit is one
of them:
http://download.eclipse.org/tools/orbit/downloads/drops/R201 00519200754/
Springsource offers another:
http://www.springsource.com/repository/app/
However, if for whatever reason you do not want to or cannot turn your
jars into OSGi bundles, then I'd suggest you go with the prebind action
as seen above.
Regards,
Johannes
|
|
| | |
Re: plugin jar dependencies [message #540616 is a reply to message #540597] |
Wed, 16 June 2010 13:38   |
Eclipse User |
|
|
|
Thanks Thomas, Johannes,
Sorry, meant to reply here
Ok, this is clear now. However, there is still something I don't understand. If my common plugin contains CSPEX with prebind action, where do I specify how to get these jars from svn? If I add a provider that points to location of the jars then during materialization these jars are being materialized into workspace which throws errors that jar is a file and not a directory.
If I take approach that you suggested of bundling up jar in the plugin, I get these errors during materialization:
mail.jar:jar: Using resolver Local resolver
iwaeutil.jar:jar: Using resolver Local resolver
axis2-kernel-1.4.jar:jar: Trying provider svn({0}/dependencies/trunk/{1})
iwconfigsm.jar:jar: Using resolver Local resolver
iwresource.jar:jar: Using resolver Local resolver
Errors and Warnings
E [0000] : No suitable provider for component geronimo-stax-api_1.0_spec-1.0.1.jar:jar was found in resourceMap file:/home/akravets2/dev/workspaces/pluto.build/com.iwaysoftware.integration.tools.site/site.svn.rmap
E [0000] : No suitable provider for component geronimo-stax-api_1.0_spec-1.0.1.jar:jar was found in searchPath resources
E [0000] : Rejecting provider svn({0}/dependencies/trunk/{1}): Components of type jar are not supported
E [0000] : Rejecting provider svn({0}/iIT/trunk/features/{1}): Components of type jar are not supported
E [0000] : Rejecting provider svn({0}/iIT/trunk/plugins/{1}): Components of type jar are not supported
E [0000] : Rejecting provider svn({0}/Explorer/trunk/plugins/{1}): Components of type jar are not supported
commons-codec-1.3.jar:jar: Trying provider svn({0}/dependencies/trunk/{1})
j2ee.jar:jar: Using search path resources
axis2-kernel-1.4.jar:jar: Rejecting provider svn({0}/dependencies/trunk/{1}): Components of type jar are not supported
axis2-kernel-1.4.jar:jar: Trying provider svn({0}/iIT/trunk/features/{1})
Does line "mail.jar:jar: Using resolver Local resolver" mean that jar was located correctly?
thanks,
Alex
[Updated on: Wed, 16 June 2010 15:03] by Moderator
|
|
|
Re: plugin jar dependencies [message #540647 is a reply to message #540616] |
Wed, 16 June 2010 16:08  |
Eclipse User |
|
|
|
Hi Alex,
The cspex contains an additional dependency to the jar. During import, the resolver will make an attempt to resolve this
dependency which means that it will consult your rmap in order to find it. Your rmap must contain a provider that is
capable of finding and materializing the jar. I.e. this component is treated just like any other component would.
- thomas
On 06/16/2010 07:38 PM, Alex wrote:
> Thanks Thomas, Johannes,
>
> Sorry, meant to reply here
>
> Ok, this is clear now. However, there is still something I don't
> understand. If my common plugin contains CSPEX with prebind action,
> where do I specify how to get these jars from svn? If I add a provider
> that points to location of the jars then during materialization these
> jars are being materialized into workspace which throws errors.
>
> thanks,
> Alex
|
|
|
Goto Forum:
Current Time: Sat May 17 09:25:47 EDT 2025
Powered by FUDForum. Page generated in 0.07869 seconds
|