Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Target Definition and deployed plugins = class path problem in build.xml
Target Definition and deployed plugins = class path problem in build.xml [message #44649] Wed, 04 February 2009 09:54 Go to next message
Rhodan76 Mising name is currently offline Rhodan76 Mising nameFriend
Messages: 71
Registered: July 2009
Member
Hello,

i have an rcp application, for which i try to set up an target definition.
In these target definition i include the rcp delta pack AND some own
plugins. These own plugins are mainly wrapping a library and have
additionally rcp classes.

To use these plugins in my target definition i do an export of the plugins
(Export-> PDE -> deployable plugins) and deploy it into an special folder
of my workspace. These folder(s) i have added to my target definitnion
file.

Now the problem:

First try: When i export these plugins as jar's (and set the target
definition for my workspace), then the eclipse compiler moans, that he
cannot find the classes of the wrapped library inside the plugin.jar. (My
workspace is getting red due to of missing library classes)

Second try: But when i export these plugins as pure directory (not jar'ed)
the eclipse compiler finds the classes inside the wrapped jar, but i'm
getting problem when doing an product export of my whole project. The
Product Export (or ant build) now doesn't find the plugin classes of the
deployed plugins!


The ant build of my product log these failures:

[javac] The import com.xyz.my.deployed.plugin.rcp cannot be resolved


Summary:

exporting my library wrapping plugins as jar -> the eclipse compiler
doesn't find the classes of the jar's inside the plugin

exporting my library wrapping plugins as directory -> running the product
build by build.xml --> the javac-compiler doesn't find the wrapping plugin
classes.


What can i do ?
Re: Target Definition and deployed plugins = class path problem in build.xml [message #44713 is a reply to message #44649] Wed, 04 February 2009 10:24 Go to previous messageGo to next message
Matthias Kappeller is currently offline Matthias KappellerFriend
Messages: 54
Registered: July 2009
Member
I follow you use this new folder (referenced by your target definition) as
a target platform in your workspace?

If that's right you have to set this folder also as a target platform in
your build. Set the property 'baseLocation' (in any way) when you start
the headless eclipse build to the folder you use in your target platform.

-Matthias

S.Schnabl wrote:

> Hello,

> i have an rcp application, for which i try to set up an target definition.
> In these target definition i include the rcp delta pack AND some own
> plugins. These own plugins are mainly wrapping a library and have
> additionally rcp classes.

> To use these plugins in my target definition i do an export of the plugins
> (Export-> PDE -> deployable plugins) and deploy it into an special folder
> of my workspace. These folder(s) i have added to my target definitnion
> file.

> Now the problem:

> First try: When i export these plugins as jar's (and set the target
> definition for my workspace), then the eclipse compiler moans, that he
> cannot find the classes of the wrapped library inside the plugin.jar. (My
> workspace is getting red due to of missing library classes)

> Second try: But when i export these plugins as pure directory (not jar'ed)
> the eclipse compiler finds the classes inside the wrapped jar, but i'm
> getting problem when doing an product export of my whole project. The
> Product Export (or ant build) now doesn't find the plugin classes of the
> deployed plugins!


> The ant build of my product log these failures:

> [javac] The import com.xyz.my.deployed.plugin.rcp cannot be resolved


> Summary:

> exporting my library wrapping plugins as jar -> the eclipse compiler
> doesn't find the classes of the jar's inside the plugin

> exporting my library wrapping plugins as directory -> running the product
> build by build.xml --> the javac-compiler doesn't find the wrapping plugin
> classes.


> What can i do ?
Re: Target Definition and deployed plugins = class path problem in build.xml [message #44742 is a reply to message #44713] Wed, 04 February 2009 11:53 Go to previous messageGo to next message
Rhodan76 Mising name is currently offline Rhodan76 Mising nameFriend
Messages: 71
Registered: July 2009
Member
> If that's right you have to set this folder also as a target platform in
> your build. Set the property 'baseLocation' (in any way) when you start
> the headless eclipse build to the folder you use in your target platform.

Currently there we are not doing an headless build. I simply use the
genereated build.xml when you do right click on plugin.xml -> PDE Tools ->
Create Ant Build File.

Is there a way to tweak the build.xml file ? Or must i define this
property explicitly in the build.properties tab ?
Re: Target Definition and deployed plugins = class path problem in build.xml [message #44802 is a reply to message #44742] Wed, 04 February 2009 12:21 Go to previous messageGo to next message
Matthias Kappeller is currently offline Matthias KappellerFriend
Messages: 54
Registered: July 2009
Member
If you run your build.xml in an eclipse you have to be sure your target
platform is set up correct ;)

When you generate an build.xml of a plugin it contains a @dot.classpath
(target @dot) where all required plugins and their paths are listed. Check
them and look for the path of the bundle which contains the package
'com.xyz.my.deployed.plugin.rcp'.

If everything is set up right check this bundle if the manifest is ok...

This is an example of a Manifest from a bundle which wrapps commons-lang:
Manifest-Version: 1.0
Bundle-Name: commons_lang
Bundle-ClassPath: lib/commons-lang.jar
Bundle-RequiredExecutionEnvironment: J2SE-1.4
Bundle-Vendor: rtc.ch
Bundle-ManifestVersion: 2
Bundle-SymbolicName: ch.rtc.rosi.commons_lang
Export-Package: org.apache.commons.lang,org.apache.commons.lang.builde
r,org.apache.commons.lang.enums,org.apache.commons.lang.exce ption,org
.apache.commons.lang.math,org.apache.commons.lang.mutable,or g.apache.
commons.lang.text,org.apache.commons.lang.time
Bundle-Version: 2.2.0.200902032205

The referenced path in @dot.classpath contains
'eclipse/plugins/ch.rtc.rosi.commons_lang_2.2.0.200902032205 /lib/commons-lang.jar'


Rhodan76 wrote:

>> If that's right you have to set this folder also as a target platform in
>> your build. Set the property 'baseLocation' (in any way) when you start
>> the headless eclipse build to the folder you use in your target platform.

> Currently there we are not doing an headless build. I simply use the
> genereated build.xml when you do right click on plugin.xml -> PDE Tools ->
> Create Ant Build File.

> Is there a way to tweak the build.xml file ? Or must i define this
> property explicitly in the build.properties tab ?
Re: Target Definition and deployed plugins = class path problem in build.xml [message #44828 is a reply to message #44802] Wed, 04 February 2009 12:42 Go to previous messageGo to next message
Rhodan76 Mising name is currently offline Rhodan76 Mising nameFriend
Messages: 71
Registered: July 2009
Member
the @dot class path in build.xml looks like:

<pathelement path="../Deployed Plugins
Folder/plugins/com.xyz.my.deployed.plugin.rcp_2.1.10/@dot"/ >
<pathelement path="../Deployed Plugins
Folder/plugins/com.xyz.my.deployed.plugin.rcp_2.1.10/lib/apa che/commons-math-1.2.jar "/>
<pathelement path="../Deployed Plugins
Folder/plugins/com.xyz.my.deployed.plugin.rcp_2.1.10/lib/apa che/commons-codec-1.3.jar "/>


Also the bundle classpath in MANIFEST.MF looks ok:

Bundle-ClassPath: .,
lib/apache/commons-math-1.2.jar,
lib/apache/commons-codec-1.3.jar

I think that i correctly set the target platform (aka. definition). In my
Eclipse Workbench all is ok after setting the target platform.

Only the build (regardles of doing an .product-file build) or only by
build.xml fails with:

[javac] The import com.xyz.plugin.rcp cannot be resolved
Re: Target Definition and deployed plugins = class path problem in build.xml [message #44858 is a reply to message #44828] Wed, 04 February 2009 13:25 Go to previous messageGo to next message
Rhodan76 Mising name is currently offline Rhodan76 Mising nameFriend
Messages: 71
Registered: July 2009
Member
Could it be an absolute/relative path problem during build ? My own
deployed plugins are in an extra folder inside of my workspace and
referenced in the target definition file by:

<location path="${workspace_loc}\Deployed Plugins Folder"/>


In javaCompiler...args file i see (absolut?) entries like:

#ADAPTER#ACCESS#Deployed Plugins
Folder/plugins/com.xyz.plugin.rcp_2.1.10@dot[+com/xyz/plugin/rcp/*;+com/xyz/plugin/rcp/common
...]
Re: Target Definition and deployed plugins = class path problem in build.xml [message #44887 is a reply to message #44828] Wed, 04 February 2009 13:27 Go to previous messageGo to next message
Matthias Kappeller is currently offline Matthias KappellerFriend
Messages: 54
Registered: July 2009
Member
I see your problem; your plugin com.xyz.my.deployed.plugin.rcp_2.1.10
contains additional jars and your own code.

Take the build.properties of the com.xyz.my.deployed.plugin.rcp plugin and
add the following:

bin.includes = META-INF/,\
commons-codec-1.3.jar,\
commons-math-1.2.jar
source.com.xyz.my.deployed.plugin.rcp.jar = src

(where 'src' must be your source directory which contains your own code.
This must create an additional jar with your code.)
Manifest:

Bundle-ClassPath: commons-codec-1.3.jar,
commons-math-1.2.jar,
com.xyz.my.deployed.plugin.rcp.jar

Export the plugin com.xyz.my.deployed.plugin.rcp again in your Deployed
Plugins Folder; generate the build.xml once again. Now the line
<pathelement path="../Deployed Plugins
Folder/plugins/com.xyz.my.deployed.plugin.rcp_2.1.10/@dot"/ > will look
like <pathelement path="../Deployed Plugins
Folder/plugins/com.xyz.my.deployed.plugin.rcp_2.1.10/com.xyz .my.deployed.plugin.rcp.jar "/>

hopefully that's the solution ;)

S.Schnabl wrote:

> the @dot class path in build.xml looks like:

> <pathelement path="../Deployed Plugins
> Folder/plugins/com.xyz.my.deployed.plugin.rcp_2.1.10/@dot"/ >
> <pathelement path="../Deployed Plugins
>
Folder/plugins/com.xyz.my.deployed.plugin.rcp_2.1.10/lib/apa che/commons-math-1.2.jar "/>
> <pathelement path="../Deployed Plugins
>
Folder/plugins/com.xyz.my.deployed.plugin.rcp_2.1.10/lib/apa che/commons-codec-1.3.jar "/>


> Also the bundle classpath in MANIFEST.MF looks ok:

> Bundle-ClassPath: .,
> lib/apache/commons-math-1.2.jar,
> lib/apache/commons-codec-1.3.jar

> I think that i correctly set the target platform (aka. definition). In my
> Eclipse Workbench all is ok after setting the target platform.

> Only the build (regardles of doing an .product-file build) or only by
> build.xml fails with:

> [javac] The import com.xyz.plugin.rcp cannot be resolved
Re: Target Definition and deployed plugins = class path problem in build.xml [message #44901 is a reply to message #44887] Wed, 04 February 2009 14:31 Go to previous messageGo to next message
Rhodan76 Mising name is currently offline Rhodan76 Mising nameFriend
Messages: 71
Registered: July 2009
Member
Yeah, great. That works ! But i didn't really understand why ;-)
Please explain me, what we are doing here - i can only see, that an
additionally jar consisting my classes has been created.
Re: Target Definition and deployed plugins = class path problem in build.xml [message #45165 is a reply to message #44901] Thu, 05 February 2009 07:04 Go to previous messageGo to next message
Matthias Kappeller is currently offline Matthias KappellerFriend
Messages: 54
Registered: July 2009
Member
If you generate an build.xml he asumes that if you require a bundle which
exists as a folder and contains source that he can build this bundle and
reference the '@dot' folder.

BUT you already have build this bundle and it only contains .class files
and these .jar's. So there is no @dot folder.

And unnoted by that fact it's good practise to pack .class files in a jar
;-) not in a folder.

Rhodan76 wrote:

> Yeah, great. That works ! But i didn't really understand why ;-)
> Please explain me, what we are doing here - i can only see, that an
> additionally jar consisting my classes has been created.
Re: Target Definition and deployed plugins = class path problem in build.xml [message #45222 is a reply to message #45165] Thu, 05 February 2009 07:56 Go to previous message
Rhodan76 Mising name is currently offline Rhodan76 Mising nameFriend
Messages: 71
Registered: July 2009
Member
> And unnoted by that fact it's good practise to pack .class files in a jar
> ;-) not in a folder.

Yes indeed ;-) But i run into compile errors when i deployed the plugins
as jars into the workspace. The workspace/compiler didn't find classes
which are in nested jars inside the plugin.jar's.

As a workaround i deployed my plugins as folder into the workspace.

Don't know, why it's not bad when deploying as jar with nested jars. Could
it be related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=157375 ?
Re: Target Definition and deployed plugins = class path problem in build.xml [message #591301 is a reply to message #44649] Wed, 04 February 2009 10:24 Go to previous message
Matthias Kappeller is currently offline Matthias KappellerFriend
Messages: 54
Registered: July 2009
Member
I follow you use this new folder (referenced by your target definition) as
a target platform in your workspace?

If that's right you have to set this folder also as a target platform in
your build. Set the property 'baseLocation' (in any way) when you start
the headless eclipse build to the folder you use in your target platform.

-Matthias

S.Schnabl wrote:

> Hello,

> i have an rcp application, for which i try to set up an target definition.
> In these target definition i include the rcp delta pack AND some own
> plugins. These own plugins are mainly wrapping a library and have
> additionally rcp classes.

> To use these plugins in my target definition i do an export of the plugins
> (Export-> PDE -> deployable plugins) and deploy it into an special folder
> of my workspace. These folder(s) i have added to my target definitnion
> file.

> Now the problem:

> First try: When i export these plugins as jar's (and set the target
> definition for my workspace), then the eclipse compiler moans, that he
> cannot find the classes of the wrapped library inside the plugin.jar. (My
> workspace is getting red due to of missing library classes)

> Second try: But when i export these plugins as pure directory (not jar'ed)
> the eclipse compiler finds the classes inside the wrapped jar, but i'm
> getting problem when doing an product export of my whole project. The
> Product Export (or ant build) now doesn't find the plugin classes of the
> deployed plugins!


> The ant build of my product log these failures:

> [javac] The import com.xyz.my.deployed.plugin.rcp cannot be resolved


> Summary:

> exporting my library wrapping plugins as jar -> the eclipse compiler
> doesn't find the classes of the jar's inside the plugin

> exporting my library wrapping plugins as directory -> running the product
> build by build.xml --> the javac-compiler doesn't find the wrapping plugin
> classes.


> What can i do ?
Re: Target Definition and deployed plugins = class path problem in build.xml [message #591309 is a reply to message #44713] Wed, 04 February 2009 11:53 Go to previous message
Rhodan76 Mising name is currently offline Rhodan76 Mising nameFriend
Messages: 71
Registered: July 2009
Member
> If that's right you have to set this folder also as a target platform in
> your build. Set the property 'baseLocation' (in any way) when you start
> the headless eclipse build to the folder you use in your target platform.

Currently there we are not doing an headless build. I simply use the
genereated build.xml when you do right click on plugin.xml -> PDE Tools ->
Create Ant Build File.

Is there a way to tweak the build.xml file ? Or must i define this
property explicitly in the build.properties tab ?
Re: Target Definition and deployed plugins = class path problem in build.xml [message #591322 is a reply to message #44742] Wed, 04 February 2009 12:21 Go to previous message
Matthias Kappeller is currently offline Matthias KappellerFriend
Messages: 54
Registered: July 2009
Member
If you run your build.xml in an eclipse you have to be sure your target
platform is set up correct ;)

When you generate an build.xml of a plugin it contains a @dot.classpath
(target @dot) where all required plugins and their paths are listed. Check
them and look for the path of the bundle which contains the package
'com.xyz.my.deployed.plugin.rcp'.

If everything is set up right check this bundle if the manifest is ok...

This is an example of a Manifest from a bundle which wrapps commons-lang:
Manifest-Version: 1.0
Bundle-Name: commons_lang
Bundle-ClassPath: lib/commons-lang.jar
Bundle-RequiredExecutionEnvironment: J2SE-1.4
Bundle-Vendor: rtc.ch
Bundle-ManifestVersion: 2
Bundle-SymbolicName: ch.rtc.rosi.commons_lang
Export-Package: org.apache.commons.lang,org.apache.commons.lang.builde
r,org.apache.commons.lang.enums,org.apache.commons.lang.exce ption,org
.apache.commons.lang.math,org.apache.commons.lang.mutable,or g.apache.
commons.lang.text,org.apache.commons.lang.time
Bundle-Version: 2.2.0.200902032205

The referenced path in @dot.classpath contains
'eclipse/plugins/ch.rtc.rosi.commons_lang_2.2.0.200902032205 /lib/commons-lang.jar'


Rhodan76 wrote:

>> If that's right you have to set this folder also as a target platform in
>> your build. Set the property 'baseLocation' (in any way) when you start
>> the headless eclipse build to the folder you use in your target platform.

> Currently there we are not doing an headless build. I simply use the
> genereated build.xml when you do right click on plugin.xml -> PDE Tools ->
> Create Ant Build File.

> Is there a way to tweak the build.xml file ? Or must i define this
> property explicitly in the build.properties tab ?
Re: Target Definition and deployed plugins = class path problem in build.xml [message #591328 is a reply to message #44802] Wed, 04 February 2009 12:42 Go to previous message
Rhodan76 Mising name is currently offline Rhodan76 Mising nameFriend
Messages: 71
Registered: July 2009
Member
the @dot class path in build.xml looks like:

<pathelement path="../Deployed Plugins
Folder/plugins/com.xyz.my.deployed.plugin.rcp_2.1.10/@dot"/ >
<pathelement path="../Deployed Plugins
Folder/plugins/com.xyz.my.deployed.plugin.rcp_2.1.10/lib/apa che/commons-math-1.2.jar "/>
<pathelement path="../Deployed Plugins
Folder/plugins/com.xyz.my.deployed.plugin.rcp_2.1.10/lib/apa che/commons-codec-1.3.jar "/>


Also the bundle classpath in MANIFEST.MF looks ok:

Bundle-ClassPath: .,
lib/apache/commons-math-1.2.jar,
lib/apache/commons-codec-1.3.jar

I think that i correctly set the target platform (aka. definition). In my
Eclipse Workbench all is ok after setting the target platform.

Only the build (regardles of doing an .product-file build) or only by
build.xml fails with:

[javac] The import com.xyz.plugin.rcp cannot be resolved
Re: Target Definition and deployed plugins = class path problem in build.xml [message #591333 is a reply to message #44828] Wed, 04 February 2009 13:25 Go to previous message
Rhodan76 Mising name is currently offline Rhodan76 Mising nameFriend
Messages: 71
Registered: July 2009
Member
Could it be an absolute/relative path problem during build ? My own
deployed plugins are in an extra folder inside of my workspace and
referenced in the target definition file by:

<location path="${workspace_loc}\Deployed Plugins Folder"/>


In javaCompiler...args file i see (absolut?) entries like:

#ADAPTER#ACCESS#Deployed Plugins
Folder/plugins/com.xyz.plugin.rcp_2.1.10@dot[+com/xyz/plugin/rcp/*;+com/xyz/plugin/rcp/common
...]
Re: Target Definition and deployed plugins = class path problem in build.xml [message #591341 is a reply to message #44828] Wed, 04 February 2009 13:27 Go to previous message
Matthias Kappeller is currently offline Matthias KappellerFriend
Messages: 54
Registered: July 2009
Member
I see your problem; your plugin com.xyz.my.deployed.plugin.rcp_2.1.10
contains additional jars and your own code.

Take the build.properties of the com.xyz.my.deployed.plugin.rcp plugin and
add the following:

bin.includes = META-INF/,\
commons-codec-1.3.jar,\
commons-math-1.2.jar
source.com.xyz.my.deployed.plugin.rcp.jar = src

(where 'src' must be your source directory which contains your own code.
This must create an additional jar with your code.)
Manifest:

Bundle-ClassPath: commons-codec-1.3.jar,
commons-math-1.2.jar,
com.xyz.my.deployed.plugin.rcp.jar

Export the plugin com.xyz.my.deployed.plugin.rcp again in your Deployed
Plugins Folder; generate the build.xml once again. Now the line
<pathelement path="../Deployed Plugins
Folder/plugins/com.xyz.my.deployed.plugin.rcp_2.1.10/@dot"/ > will look
like <pathelement path="../Deployed Plugins
Folder/plugins/com.xyz.my.deployed.plugin.rcp_2.1.10/com.xyz .my.deployed.plugin.rcp.jar "/>

hopefully that's the solution ;)

S.Schnabl wrote:

> the @dot class path in build.xml looks like:

> <pathelement path="../Deployed Plugins
> Folder/plugins/com.xyz.my.deployed.plugin.rcp_2.1.10/@dot"/ >
> <pathelement path="../Deployed Plugins
>
Folder/plugins/com.xyz.my.deployed.plugin.rcp_2.1.10/lib/apa che/commons-math-1.2.jar "/>
> <pathelement path="../Deployed Plugins
>
Folder/plugins/com.xyz.my.deployed.plugin.rcp_2.1.10/lib/apa che/commons-codec-1.3.jar "/>


> Also the bundle classpath in MANIFEST.MF looks ok:

> Bundle-ClassPath: .,
> lib/apache/commons-math-1.2.jar,
> lib/apache/commons-codec-1.3.jar

> I think that i correctly set the target platform (aka. definition). In my
> Eclipse Workbench all is ok after setting the target platform.

> Only the build (regardles of doing an .product-file build) or only by
> build.xml fails with:

> [javac] The import com.xyz.plugin.rcp cannot be resolved
Re: Target Definition and deployed plugins = class path problem in build.xml [message #591349 is a reply to message #44887] Wed, 04 February 2009 14:31 Go to previous message
Rhodan76 Mising name is currently offline Rhodan76 Mising nameFriend
Messages: 71
Registered: July 2009
Member
Yeah, great. That works ! But i didn't really understand why ;-)
Please explain me, what we are doing here - i can only see, that an
additionally jar consisting my classes has been created.
Re: Target Definition and deployed plugins = class path problem in build.xml [message #591450 is a reply to message #44901] Thu, 05 February 2009 07:04 Go to previous message
Matthias Kappeller is currently offline Matthias KappellerFriend
Messages: 54
Registered: July 2009
Member
If you generate an build.xml he asumes that if you require a bundle which
exists as a folder and contains source that he can build this bundle and
reference the '@dot' folder.

BUT you already have build this bundle and it only contains .class files
and these .jar's. So there is no @dot folder.

And unnoted by that fact it's good practise to pack .class files in a jar
;-) not in a folder.

Rhodan76 wrote:

> Yeah, great. That works ! But i didn't really understand why ;-)
> Please explain me, what we are doing here - i can only see, that an
> additionally jar consisting my classes has been created.
Re: Target Definition and deployed plugins = class path problem in build.xml [message #591465 is a reply to message #45165] Thu, 05 February 2009 07:56 Go to previous message
Rhodan76 Mising name is currently offline Rhodan76 Mising nameFriend
Messages: 71
Registered: July 2009
Member
> And unnoted by that fact it's good practise to pack .class files in a jar
> ;-) not in a folder.

Yes indeed ;-) But i run into compile errors when i deployed the plugins
as jars into the workspace. The workspace/compiler didn't find classes
which are in nested jars inside the plugin.jar's.

As a workaround i deployed my plugins as folder into the workspace.

Don't know, why it's not bad when deploying as jar with nested jars. Could
it be related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=157375 ?
Previous Topic:How to create config.ini file to accept any eclipse plugins in my rcp
Next Topic:Can I use ant build rcp product?Anybody has correct example?
Goto Forum:
  


Current Time: Tue Jun 22 03:05:55 GMT 2021

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

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

Back to the top