Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Plug-in development dependencies
Plug-in development dependencies [message #312821] Wed, 21 February 2007 10:42 Go to next message
Eclipse UserFriend
Originally posted by: none.gmail.com

Hi all,

I am working on a plug-in that is dependent upon a java project in my
workspace. For design time there is not problem, because I can add the
project to my build properties. At runtime though I get a missing class
error because there is no jar for my java project on the runtime classpath.

Is there a way to reference a java project in your workspace during
runtime, and if not is there a way to build the jars and copy them to my
plug-in project every time I build the dependent java project?

Thanks guys,
Scott
Re: Plug-in development dependencies [message #312822 is a reply to message #312821] Wed, 21 February 2007 10:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Scott,

For plugin projects, never modify the Java classpath directly. Edit the
MANIFEST.MF and use the dependencies tab to add dependencies on other
plugins.


Scott Hathaway wrote:
> Hi all,
>
> I am working on a plug-in that is dependent upon a java project in my
> workspace. For design time there is not problem, because I can add the
> project to my build properties. At runtime though I get a missing
> class error because there is no jar for my java project on the runtime
> classpath.
>
> Is there a way to reference a java project in your workspace during
> runtime, and if not is there a way to build the jars and copy them to
> my plug-in project every time I build the dependent java project?
>
> Thanks guys,
> Scott
Re: Plug-in development dependencies [message #312824 is a reply to message #312822] Wed, 21 February 2007 10:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.gmail.com

I understand this point, but my dependent project is not another
plug-in. At runtime it will be a jar on the runtime classpath. For
example if you need to access classes in the axis.jar you would add it
to the runtime dependencies in your manifest. Lets say though that the
axis.jar code is in a java project in your workspace. In order to debug
the axis code that is called from your plug-in you would have to create
a jar of the axis code, copy it to your plug-in project, and make sure
it was on the runtime classpath. I want to know if you can bypass the
jar creation step, so I can make changes to my java project without
having to create a new jar every time I want to test a change.

Ed Merks wrote:
> Scott,
>
> For plugin projects, never modify the Java classpath directly. Edit the
> MANIFEST.MF and use the dependencies tab to add dependencies on other
> plugins.
>
>
> Scott Hathaway wrote:
>> Hi all,
>>
>> I am working on a plug-in that is dependent upon a java project in my
>> workspace. For design time there is not problem, because I can add the
>> project to my build properties. At runtime though I get a missing
>> class error because there is no jar for my java project on the runtime
>> classpath.
>>
>> Is there a way to reference a java project in your workspace during
>> runtime, and if not is there a way to build the jars and copy them to
>> my plug-in project every time I build the dependent java project?
>>
>> Thanks guys,
>> Scott
Re: Plug-in development dependencies [message #312827 is a reply to message #312824] Wed, 21 February 2007 11:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Scott,

You should make the other project also be a plugin project and make its
manifest's classpath point at the jar that's contained within that
project by using the Runtime tab to add the jar to the MANIFEST.



Scott Hathaway wrote:
> I understand this point, but my dependent project is not another
> plug-in. At runtime it will be a jar on the runtime classpath. For
> example if you need to access classes in the axis.jar you would add it
> to the runtime dependencies in your manifest. Lets say though that the
> axis.jar code is in a java project in your workspace. In order to
> debug the axis code that is called from your plug-in you would have to
> create a jar of the axis code, copy it to your plug-in project, and
> make sure it was on the runtime classpath. I want to know if you can
> bypass the jar creation step, so I can make changes to my java project
> without having to create a new jar every time I want to test a change.
>
> Ed Merks wrote:
>> Scott,
>>
>> For plugin projects, never modify the Java classpath directly. Edit
>> the MANIFEST.MF and use the dependencies tab to add dependencies on
>> other plugins.
>>
>>
>> Scott Hathaway wrote:
>>> Hi all,
>>>
>>> I am working on a plug-in that is dependent upon a java project in
>>> my workspace. For design time there is not problem, because I can
>>> add the project to my build properties. At runtime though I get a
>>> missing class error because there is no jar for my java project on
>>> the runtime classpath.
>>>
>>> Is there a way to reference a java project in your workspace during
>>> runtime, and if not is there a way to build the jars and copy them
>>> to my plug-in project every time I build the dependent java project?
>>>
>>> Thanks guys,
>>> Scott
Re: Plug-in development dependencies [message #312831 is a reply to message #312827] Wed, 21 February 2007 11:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.gmail.com

Ed Merks wrote:
> Scott,
>
> You should make the other project also be a plugin project and make its
> manifest's classpath point at the jar that's contained within that
> project by using the Runtime tab to add the jar to the MANIFEST.
>
>
>
> Scott Hathaway wrote:
>> I understand this point, but my dependent project is not another
>> plug-in. At runtime it will be a jar on the runtime classpath. For
>> example if you need to access classes in the axis.jar you would add it
>> to the runtime dependencies in your manifest. Lets say though that the
>> axis.jar code is in a java project in your workspace. In order to
>> debug the axis code that is called from your plug-in you would have to
>> create a jar of the axis code, copy it to your plug-in project, and
>> make sure it was on the runtime classpath. I want to know if you can
>> bypass the jar creation step, so I can make changes to my java project
>> without having to create a new jar every time I want to test a change.
>>
This will work for development, but it isn't really a final solution for
me. The java project that I am working on that I need the jar for is
more than likely going to be used in some non-eclipse projects. It looks
like the best solution is a custom build.xml that creates and copies the
jar to the plug-in project when the java project is built.

Thanks for your quick responses Ed!

>> Ed Merks wrote:
>>> Scott,
>>>
>>> For plugin projects, never modify the Java classpath directly. Edit
>>> the MANIFEST.MF and use the dependencies tab to add dependencies on
>>> other plugins.
>>>
>>>
>>> Scott Hathaway wrote:
>>>> Hi all,
>>>>
>>>> I am working on a plug-in that is dependent upon a java project in
>>>> my workspace. For design time there is not problem, because I can
>>>> add the project to my build properties. At runtime though I get a
>>>> missing class error because there is no jar for my java project on
>>>> the runtime classpath.
>>>>
>>>> Is there a way to reference a java project in your workspace during
>>>> runtime, and if not is there a way to build the jars and copy them
>>>> to my plug-in project every time I build the dependent java project?
>>>>
>>>> Thanks guys,
>>>> Scott
Re: Plug-in development dependencies [message #312832 is a reply to message #312831] Wed, 21 February 2007 12:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Scott,

I see. It might not help you directly, but in EMF we produce plugin
jars that also work properly when you put then on a stand alone
classpath. So if your plugin project doesn't use any Eclipse APIs, you
should be able to export a jar that also works standalone (given that
the other jar is also on the classpath).


Scott Hathaway wrote:
> Ed Merks wrote:
>> Scott,
>>
>> You should make the other project also be a plugin project and make
>> its manifest's classpath point at the jar that's contained within
>> that project by using the Runtime tab to add the jar to the MANIFEST.
>>
>>
>>
>> Scott Hathaway wrote:
>>> I understand this point, but my dependent project is not another
>>> plug-in. At runtime it will be a jar on the runtime classpath. For
>>> example if you need to access classes in the axis.jar you would add
>>> it to the runtime dependencies in your manifest. Lets say though
>>> that the axis.jar code is in a java project in your workspace. In
>>> order to debug the axis code that is called from your plug-in you
>>> would have to create a jar of the axis code, copy it to your plug-in
>>> project, and make sure it was on the runtime classpath. I want to
>>> know if you can bypass the jar creation step, so I can make changes
>>> to my java project without having to create a new jar every time I
>>> want to test a change.
>>>
> This will work for development, but it isn't really a final solution
> for me. The java project that I am working on that I need the jar for
> is more than likely going to be used in some non-eclipse projects. It
> looks like the best solution is a custom build.xml that creates and
> copies the jar to the plug-in project when the java project is built.
>
> Thanks for your quick responses Ed!
>
>>> Ed Merks wrote:
>>>> Scott,
>>>>
>>>> For plugin projects, never modify the Java classpath directly.
>>>> Edit the MANIFEST.MF and use the dependencies tab to add
>>>> dependencies on other plugins.
>>>>
>>>>
>>>> Scott Hathaway wrote:
>>>>> Hi all,
>>>>>
>>>>> I am working on a plug-in that is dependent upon a java project in
>>>>> my workspace. For design time there is not problem, because I can
>>>>> add the project to my build properties. At runtime though I get a
>>>>> missing class error because there is no jar for my java project on
>>>>> the runtime classpath.
>>>>>
>>>>> Is there a way to reference a java project in your workspace
>>>>> during runtime, and if not is there a way to build the jars and
>>>>> copy them to my plug-in project every time I build the dependent
>>>>> java project?
>>>>>
>>>>> Thanks guys,
>>>>> Scott
Re: Plug-in development dependencies [message #312838 is a reply to message #312831] Wed, 21 February 2007 14:30 Go to previous messageGo to next message
Eclipse UserFriend
Scott Hathaway wrote:

> This will work for development, but it isn't really a final solution for
> me. The java project that I am working on that I need the jar for is
> more than likely going to be used in some non-eclipse projects. It looks
> like the best solution is a custom build.xml that creates and copies the
> jar to the plug-in project when the java project is built.

That doesn't mean it can't be a plugin.

org.eclipse.jface_3.2.<whatever>.jar is a plugin in eclipse. But it is
also just a jar used in normal java applications.

You can take any *normal* java jar and make it a plugin while inside
eclipse by adding the appropriate headers to the jar MANIFEST.MF ...
what's more, those headers will not interfere with it running in a
normal java app (they are just ignored).

Later,
PW
Re: Plug-in development dependencies [message #312839 is a reply to message #312831] Wed, 21 February 2007 14:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wharley.bea.com

"Scott Hathaway" <none@gmail.com> wrote in message
news:erhst9$9vq$1@utils.eclipse.org...
> This will work for development, but it isn't really a final solution for
> me. The java project that I am working on that I need the jar for is more
> than likely going to be used in some non-eclipse projects. It looks like
> the best solution is a custom build.xml that creates and copies the jar to
> the plug-in project when the java project is built.

A plug-in is just a jar file with some extra entries in its manifest that
allow it to run under OSGi. Everything else (plugin.xml, use of Eclipse
APIs, Activator class, etc.) is optional. The extra manifest entries do not
interfere with use outside of OSGi (ie outside of Eclipse).

To create the .jar file, you just "Export... -> Deployable Plug-ins or
Fragments", and tell it to "Package plug-ins as individual archives" on the
options tab of the export wizard. This is identical to what you'd do to
export the other plug-in. You don't need to do this in order to debug
inside Eclipse, though, only when you're ready to deploy.

So: it is very easy to make a plug-in that is useable outside of Eclipse;
and it is comparatively hard to make a jar file that is useable from a
plug-in. I'd suggest taking the former path.
Re: Plug-in development dependencies [message #312847 is a reply to message #312839] Wed, 21 February 2007 17:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.gmail.com

Excellent! Thanks guys this is just what I needed to know.


Walter Harley wrote:
> "Scott Hathaway" <none@gmail.com> wrote in message


> news:erhst9$9vq$1@utils.eclipse.org...
>> This will work for development, but it isn't really a final solution for
>> me. The java project that I am working on that I need the jar for is more
>> than likely going to be used in some non-eclipse projects. It looks like
>> the best solution is a custom build.xml that creates and copies the jar to
>> the plug-in project when the java project is built.
>
> A plug-in is just a jar file with some extra entries in its manifest that
> allow it to run under OSGi. Everything else (plugin.xml, use of Eclipse
> APIs, Activator class, etc.) is optional. The extra manifest entries do not
> interfere with use outside of OSGi (ie outside of Eclipse).
>
> To create the .jar file, you just "Export... -> Deployable Plug-ins or
> Fragments", and tell it to "Package plug-ins as individual archives" on the
> options tab of the export wizard. This is identical to what you'd do to
> export the other plug-in. You don't need to do this in order to debug
> inside Eclipse, though, only when you're ready to deploy.
>
> So: it is very easy to make a plug-in that is useable outside of Eclipse;
> and it is comparatively hard to make a jar file that is useable from a
> plug-in. I'd suggest taking the former path.
>
>
Re: Plug-in development dependencies [message #312864 is a reply to message #312821] Thu, 22 February 2007 06:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lamont_gilbert.rigidsoftware.com

On Wed, 21 Feb 2007 10:42:48 -0500, Scott Hathaway wrote:

> Hi all,
>
> I am working on a plug-in that is dependent upon a java project in my
> workspace. For design time there is not problem, because I can add the
> project to my build properties. At runtime though I get a missing class
> error because there is no jar for my java project on the runtime
> classpath.
>
> Is there a way to reference a java project in your workspace during
> runtime, and if not is there a way to build the jars and copy them to my
> plug-in project every time I build the dependent java project?
>
> Thanks guys,
> Scott

There is no clean way to do this. You can probably create an ant script
in the java project that rebuilds and copies the jar file into the plugin
project, but there is a bug right now that makes the jar not fully
recognized.

What I do anyway is to jar the java project into a lib directory of the
plugin project. I typically include the source in the jar for debugging
purposes. or make a seperate jar that contains the source. On the
plugin-projects project properties go to the build path, libraries tab and
add the jar file there. You can attach the source there as well.

For me the bug means each time I rebuild that jar I have to remove and
readd it to the plugin project.
Re: Plug-in development dependencies [message #312879 is a reply to message #312864] Thu, 22 February 2007 11:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lamont_gilbert.rigidsoftware.com

On Thu, 22 Feb 2007 06:54:18 -0500, CL 'dnoyeB' Gilbert wrote:

> On Wed, 21 Feb 2007 10:42:48 -0500, Scott Hathaway wrote:
>
>> Hi all,
>>
>> I am working on a plug-in that is dependent upon a java project in my
>> workspace. For design time there is not problem, because I can add the
>> project to my build properties. At runtime though I get a missing class
>> error because there is no jar for my java project on the runtime
>> classpath.
>>
>> Is there a way to reference a java project in your workspace during
>> runtime, and if not is there a way to build the jars and copy them to my
>> plug-in project every time I build the dependent java project?
>>
>> Thanks guys,
>> Scott
>
> There is no clean way to do this. You can probably create an ant script
> in the java project that rebuilds and copies the jar file into the plugin
> project, but there is a bug right now that makes the jar not fully
> recognized.
>
> What I do anyway is to jar the java project into a lib directory of the
> plugin project. I typically include the source in the jar for debugging
> purposes. or make a seperate jar that contains the source. On the
> plugin-projects project properties go to the build path, libraries tab and
> add the jar file there. You can attach the source there as well.
>
> For me the bug means each time I rebuild that jar I have to remove and
> readd it to the plugin project.


Note, that once this bug is fixed, it should work much like you intend.
Except that instead of putting the source in the jar file, tell Eclipse
that the source is located in ajava project. But still there are a few
drawbacks. Such as modification of the source during run/debug is not
possible.
Re: Plug-in development dependencies [message #312887 is a reply to message #312879] Thu, 22 February 2007 17:37 Go to previous message
Eclipse UserFriend
Originally posted by: wegener.cboenospam.com

As has been pointed out previously in this thread. The best way to deal
with this situation
is to convert the Java project into a plugin project. Then you don't need
to worry about
jarring up the java project on each rebuild and copying it into the
dependent plugin project.
By adding the previous Java project as a dependency of the plugin project,
it will be
referenced properly.
"CL 'dnoyeB' Gilbert" <lamont_gilbert@rigidsoftware.com> wrote in message
news:pan.2007.02.22.16.49.16.410156@rigidsoftware.com...
> On Thu, 22 Feb 2007 06:54:18 -0500, CL 'dnoyeB' Gilbert wrote:
>
> > On Wed, 21 Feb 2007 10:42:48 -0500, Scott Hathaway wrote:
> >
> >> Hi all,
> >>
> >> I am working on a plug-in that is dependent upon a java project in my
> >> workspace. For design time there is not problem, because I can add the
> >> project to my build properties. At runtime though I get a missing class
> >> error because there is no jar for my java project on the runtime
> >> classpath.
> >>
> >> Is there a way to reference a java project in your workspace during
> >> runtime, and if not is there a way to build the jars and copy them to
my
> >> plug-in project every time I build the dependent java project?
> >>
> >> Thanks guys,
> >> Scott
> >
> > There is no clean way to do this. You can probably create an ant script
> > in the java project that rebuilds and copies the jar file into the
plugin
> > project, but there is a bug right now that makes the jar not fully
> > recognized.
> >
> > What I do anyway is to jar the java project into a lib directory of the
> > plugin project. I typically include the source in the jar for debugging
> > purposes. or make a seperate jar that contains the source. On the
> > plugin-projects project properties go to the build path, libraries tab
and
> > add the jar file there. You can attach the source there as well.
> >
> > For me the bug means each time I rebuild that jar I have to remove and
> > readd it to the plugin project.
>
>
> Note, that once this bug is fixed, it should work much like you intend.
> Except that instead of putting the source in the jar file, tell Eclipse
> that the source is located in ajava project. But still there are a few
> drawbacks. Such as modification of the source during run/debug is not
> possible.
Previous Topic:How to export packages from jar file inside plugin in Eclipse 3.2?
Next Topic:Required plugins to add Software Updates in Help menu
Goto Forum:
  


Current Time: Tue Jun 03 23:37:53 EDT 2025

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

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

Back to the top