Difference between revisions of "FAQ What is the plug-in manifest file (plugin.xml)?"

From Eclipsepedia

Jump to: navigation, search
 
m
Line 1: Line 1:
The plug-in manifest file, <tt>plugin.xml</tt>, describes
+
The plug-in manifest file, <tt>plugin.xml</tt>, describes how the plug-in extends the platform, what extensions it publishes itself, and how it implements its functionality. The manifest file is written in XML and is parsed by the platform when the plug-in is loaded into the platform. All the information needed to display the plug-in in the UI, such as icons, menu items, and so on, is contained in the manifest file. The implementation code, found in a separate Java JAR file, is loaded when, and only when, the plug-in has to be run. This concept is referred to as <i>lazy loading</i>. Here is the manifest file for a simple plug-in:
how the plug-in extends the platform, what extensions it publishes itself,
+
and how it implements its functionality. The manifest file is written in  
+
XML and is parsed by the platform when the plug-in is loaded into the  
+
platform. All the information needed to display the plug-in in the UI,
+
such as icons, menu items, and so on, is contained in the manifest file. The
+
implementation code, found in a separate Java JAR file, is
+
loaded when, and only when, the plug-in has to be run. This concept
+
is referred to as <i>lazy loading</i>.
+
Here is the manifest file for a simple plug-in:
+
 
<pre>
 
<pre>
 
   &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
 
   &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
 
   &lt;?eclipse version=&quot;3.0&quot;?&gt;
 
   &lt;?eclipse version=&quot;3.0&quot;?&gt;
   &lt;plugin id=&quot;com.xyz.myplugin&quot; name=&quot;My Plugin&quot;  
+
   &lt;plugin id=&quot;com.xyz.myplugin&quot; name=&quot;My Plugin&quot; class=&quot;com.xyz.MyPlugin&quot; version=&quot;1.0&quot;&gt;
      class=&quot;com.xyz.MyPlugin&quot; version=&quot;1.0&quot;&gt;
+
 
       &lt;runtime&gt;
 
       &lt;runtime&gt;
 
         &lt;library name=&quot;MyPlugin.jar&quot;/&gt;
 
         &lt;library name=&quot;MyPlugin.jar&quot;/&gt;
Line 22: Line 12:
 
   &lt;/plugin&gt;
 
   &lt;/plugin&gt;
 
</pre>
 
</pre>
The processing instructions at the beginning specify the XML version and character
 
encoding and that this plug-in was built for version 3.0 of the Eclipse
 
Platform.  The <tt>plugin</tt> element specifies the basic information about
 
the plug-in, including, in this case, the optional <tt>class</tt> attribute to
 
specify an instance of the <tt>Plugin</tt> class associated with this plug-in.
 
Because it contains a subclass of <tt>Plugin</tt>, this plug-in must include
 
a <tt>runtime</tt> element that specifies the JAR file that contains the code
 
and a <tt>requires</tt> element to import the
 
<tt>org.eclipse.core.runtime</tt> plug-in where the superclass resides.
 
The manifest may also specify <i>extensions</i> and <i>extension points</i>
 
associated with the plug-in. Of all
 
this, only the <tt>plugin</tt> element with the <tt>id</tt>, <tt>name</tt>, and
 
<tt>version</tt> attributes are required.
 
  
 +
The processing instructions at the beginning specify the XML version and character encoding and that this plug-in was built for version 3.0 of the Eclipse Platform.  The <tt>plugin</tt> element specifies the basic information about the plug-in, including, in this case, the optional <tt>class</tt> attribute to specify an instance of the <tt>Plugin</tt> class associated with this plug-in. Because it contains a subclass of <tt>Plugin</tt>, this plug-in must include a <tt>runtime</tt> element that specifies the JAR file that contains the code and a <tt>requires</tt> element to import the <tt>org.eclipse.core.runtime</tt> plug-in where the superclass resides.  The manifest may also specify <i>extensions</i> and <i>extension points</i> associated with the plug-in. Of all this, only the <tt>plugin</tt> element with the <tt>id</tt>, <tt>name</tt>, and  <tt>version</tt> attributes are required.
  
 
== See Also: ==
 
== See Also: ==
 +
*[[FAQ What is a plug-in?]]
 +
*[[FAQ What are extensions and extension points?]]
 +
*[[FAQ When does a plug-in get started?]]
  
[[FAQ_What_is_a_plug-in%3F]]
+
{{Template:FAQ_Tagline}}
 
+
[[FAQ_What_are_extensions_and_extension_points%3F]]
+
 
+
[[FAQ_When_does_a_plug-in_get_started%3F]]
+
 
+
<hr><font size=-2>This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font>
+

Revision as of 05:00, 17 June 2006

The plug-in manifest file, plugin.xml, describes how the plug-in extends the platform, what extensions it publishes itself, and how it implements its functionality. The manifest file is written in XML and is parsed by the platform when the plug-in is loaded into the platform. All the information needed to display the plug-in in the UI, such as icons, menu items, and so on, is contained in the manifest file. The implementation code, found in a separate Java JAR file, is loaded when, and only when, the plug-in has to be run. This concept is referred to as lazy loading. Here is the manifest file for a simple plug-in:

   <?xml version="1.0" encoding="UTF-8"?>
   <?eclipse version="3.0"?>
   <plugin id="com.xyz.myplugin" name="My Plugin" class="com.xyz.MyPlugin" version="1.0">
      <runtime>
         <library name="MyPlugin.jar"/>
      </runtime>
      <requires>
         <import plugin="org.eclipse.core.runtime"/>
      </requires>
   </plugin>

The processing instructions at the beginning specify the XML version and character encoding and that this plug-in was built for version 3.0 of the Eclipse Platform. The plugin element specifies the basic information about the plug-in, including, in this case, the optional class attribute to specify an instance of the Plugin class associated with this plug-in. Because it contains a subclass of Plugin, this plug-in must include a runtime element that specifies the JAR file that contains the code and a requires element to import the org.eclipse.core.runtime plug-in where the superclass resides. The manifest may also specify extensions and extension points associated with the plug-in. Of all this, only the plugin element with the id, name, and version attributes are required.

See Also:


This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.