
= Features  =

The Virgo Tooling/IDE concept concerns the whole Virgo tooling (that was available inside SpringSource Tool Suite) being put in a separate project. The tooling supports the following: 

*Bundle projects 
*Par projects 
*Plan files/projects 
*Web Bundles 
*Deployment to a Virgo Server in the server view.

= Installation  =

==Install Eclipse==

If you're not installing into an existing Eclipse, you'll need one. 

*Eclipse Indigo 3.7.x or Indigo based suite such as SpringSource Tool Suite 2.9.x
*Eclipse Juno 3.8/4.2

Eclipse JEE Indigo recommended.

==Install Virgo==

#Select ''Help&gt;Install New Software..''
#Enter one of the Virgo update sites below.
#Select &quot;Virgo Tools&quot; feature and click install.
&lt;span style=&quot;color:#FF0000&quot;&gt;&lt;b&gt;Note:&lt;/b&gt; Select &lt;i&gt;only&lt;/i&gt; Virgo Tooling. This is a composite site, and the other features are &lt;i&gt;not&lt;/i&gt; designed to work within the Eclipse IDE.&lt;/span&gt;

==Update Sites==

;Milestone: &lt;code&gt;http://download.eclipse.org/virgo/milestone/tooling&lt;/code&gt; (Recommended)
;Snapshot: &lt;code&gt;http://download.eclipse.org/virgo/snapshot/tooling&lt;/code&gt; (Bleeding Edge)

Many users will also want to install the M2E release at: &lt;code&gt;http://download.eclipse.org/technology/m2e/releases&lt;/code&gt;. (You'll need this to run the greenpages examples.)

= Known Issues =

*The Virgo tools currently do not support Eclipse 3.6 (Helios) and derived Spring Source products. https://bugs.eclipse.org/bugs/show_bug.cgi?id=377236.
*An exception occurs when you click on an item in the Bundle Overview. This is a Libra issue that will be fixed when the next Libra build occurs. https://bugs.eclipse.org/bugs/show_bug.cgi?id=377582.
*Manifest generation does not seem to be working properly. https://bugs.eclipse.org/bugs/show_bug.cgi?id=379233
*The greenpages sample does not work. We're not yet sure if this is a tooling or runtime issue. https://bugs.eclipse.org/bugs/show_bug.cgi?id=368781 
*If you have existing Virgo server defined you will see nasty exceptions. Just follow the instructions [[#Server Versions|below]] https://bugs.eclipse.org/bugs/show_bug.cgi?id=379282
*Other significant bugs still exist. Please see these release train bugs for a current list, and please report any other issues you discover:
**368783: Server management UI bug train https://bugs.eclipse.org/bugs/show_bug.cgi?id=368783
**368785: Server runtime support bug train https://bugs.eclipse.org/bugs/show_bug.cgi?id=368785
**368782: Plugin packaging issues bug train https://bugs.eclipse.org/bugs/show_bug.cgi?id=368782
**You can see all open bugs [https://bugs.eclipse.org/bugs/buglist.cgi?list_id=1289794;query_format=advanced;bug_status=NEW;bug_status=ASSIGNED;bug_status=REOPENED;component=tooling;product=Virgo here].



= Migration  =

== From Pre M2 to M4 ==

=== Server Versions ===

The good news: We have done away with the need for managing multiple server versions. This also means that we won't have to support multiple WebTools Server Runtimes and Servers which will make adding new servers and variants much easier. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=373453 for more details.

The bad news: Any Server Runtimes that you already created for Virgo Server 3.5 will not work -- and you will see nasty exceptions if you try to use them. But since pre-M4 Virgo Tooling didn't work with Virgo Server 3.5 ''anyway'', this should be a moot issue for most people.

What to do: If you have an existing (i.e., created using Virgo IDE installed before 10 March 2012) Virgo Server 3.5 Runtime defined, just delete it and replace it with a new Virgo Runtime in ''Preferences:Server:Runtime Environments''. You'll see that the correct version is discovered automatically. Then, open any Servers that uses the old runtime and select the new one from the Runtime Environment popup menu.

== From Spring Source and Virgo 2.x Tooling ==

Moving from the old tooling to the new requires some changes to your existing projects, these are documented here. 

The Bundlor .settings file has a new name (''com.springsource.server.ide.bundlor.core.prefs'' -&amp;gt; ''org.eclipse.virgo.ide.bundlor.core.prefs'') and the property keys in it have new names as well. Currently these just need to be changed manually (replace ''com.springsource.server'' by ''org.eclipse.virgo'') '''or use the project properties pane to create new settings and delete the old one.''' (recommended)

The Bundle Dependencies classpath entry has a new name (''com.springsource.server.ide.jdt.core.MANIFEST_CLASSPATH_CONTAINER'' -&amp;gt; ''org.eclipse.virgo.ide.jdt.core.MANIFEST_CLASSPATH_CONTAINER''). This can be changed manually (in the .classpath file) or in the Java Build Path section of the project properties. 

The attributes used to mark folders as test folders have been renamed (''com.springsource.server.ide.jdt.core.test.classpathentry'' -&amp;gt; ''org.eclipse.virgo.ide.jdt.core.test.classpathentry''). This can be changed manually (in the .classpath file). 

The PAR and Bundle nature have been renamed (''com.springsource.server.ide.facet.core.bundlenature'' -&amp;gt; ''org.eclipse.virgo.ide.facet.core.bundlenature'' and (''com.springsource.server.ide.facet.core.parnature'' -&amp;gt; ''org.eclipse.virgo.ide.facet.core.parnature'')). This can be changed manually (in the .project file). 

The format and name of a PAR project changed. Rename ''.settings/com.springsource.server.ide.runtime.core.par.xml'' to ''.settings/org.eclipse.virgo.ide.runtime.core.par.xml''. Inside the file rename occurences of ''com.springsource.server'' to ''org.eclipse.virgo''. 

'''Snapshot build change:''' We've made a change in our tooling that will require modifying the org.eclipse.virgo.ide.runtime.core.par.xml file so that it points to the correct par.ecore URI. Rename ''xmlns:com.springsource.server.ide.par=&quot;http:///com/springsource/server/ide/par.ecore&quot;'' to ''&quot;xmlns:org.eclipse.virgo.ide.par=&quot;http://eclipse.org/virgo/par.ecore&quot;''

Inside the WST settings file (''.settings/org.eclipse.wst.common.project.facet.core.xml'') rename occurences of ''com.springsource.server.bundle'' to ''org.eclipse.virgo.server.bundle'' and occurences of ''com.springsource.server.par'' to ''org.eclipse.virgo.server.par''. 

Most/all of the conversion should be done by the following script (it has only see marginal testing, use at your own risk): 
&lt;pre&gt;#!/bin/sh
# NOTE1: Run this at your own risk&amp;nbsp;:)
# NOTE2: I should quote more dots in sed expressions but I'm lazy.
# TODO: Delete old com.springsource files after conversion
if [&amp;nbsp;! -d &quot;$1&quot; ]; then 
        echo &quot;Please point me at an eclipse project&quot;&amp;nbsp;; 
        exit 1
fi

# Bundlor settings
f=&quot;$1/.settings/com.springsource.server.ide.bundlor.core.prefs&quot;
[ -f &quot;$f&quot; ] &amp;amp;&amp;amp;  (
        echo &quot;$1: Converting bundlor preferences&quot;
        sed -e 's/com\.springsource\.server/org.eclipse.virgo/g' &quot;$f&quot; &amp;gt; &quot;$(echo $f | sed -e s/com.springsource.server/org.eclipse.virgo/)&quot;
)

# convert PAR
f=&quot;$1/.settings/com.springsource.server.ide.runtime.core.par.xml&quot;
[ -f &quot;$f&quot; ] &amp;amp;&amp;amp;  (
        echo &quot;$1: Converting PAR project dependencies&quot;
        sed -e 's/com\.springsource\.server/org.eclipse.virgo/g' &quot;$f&quot; &amp;gt; &quot;$(echo $f | sed -e s/com.springsource.server/org.eclipse.virgo/)&quot;
)

# Fix classpaths        
f=&quot;$1/.classpath&quot;
[ -f &quot;$f&quot; ] &amp;amp;&amp;amp; (
        echo &quot;$1: Converting classpath containers and entries&quot;
        sed -i \
                -e 's/com.springsource.server.ide.jdt.core.MANIFEST_CLASSPATH_CONTAINER/org.eclipse.virgo.ide.jdt.core.MANIFEST_CLASSPATH_CONTAINER/g' \
                -e 's/com.springsource.server.ide.jdt.core.test.classpathentry/org.eclipse.virgo.ide.jdt.core.test.classpathentry/g' \
                &quot;$f&quot;
)
        
# Fix natures..
f=&quot;$1/.project&quot;
[ -f &quot;$f&quot; ] &amp;amp;&amp;amp; (
        echo &quot;$1: Converting project natures&quot;
        sed -i \
                -e 's/com.springsource.server.ide.facet.core.bundlenature/org.eclipse.virgo.ide.facet.core.bundlenature/g' \
                -e 's/com.springsource.server.ide.facet.core.parnature/org.eclipse.virgo.ide.facet.core.parnature/g' \
                &quot;$f&quot;
)

# Fix the wst file, could also replace runtime name here
f=&quot;$1/.settings/org.eclipse.wst.common.project.facet.core.xml&quot;
[ -f &quot;$f&quot; ] &amp;amp;&amp;amp; (
        echo &quot;$1: Converting org.eclipse.wst.common.project.facet.core.xml&quot;
        sed -i \
                -e 's/com.springsource.server.bundle/org.eclipse.virgo.server.bundle/g'  \
                -e 's/com.springsource.server.par/org.eclipse.virgo.server.par/g'  \
                &quot;$f&quot;
)


&lt;/pre&gt;

= Maven plugin  =

To support the development of OSGi bundles for Eclipse Virgo with Maven a Maven plugin is available. This plugin is able to start/stop a local Eclipse Virgo instance. Moreover it is possible to deploy/undeploy/refresh bundles via Maven. 

== Build  ==

In order to use the plugin one has to download the source code from [https://github.com/frieder/virgo-maven-plugin Github]&amp;nbsp;and build the binary manually. This can be easily done by executing the following Maven command in the root folder of the plugin where the pom.xml file is located. 
&lt;pre&gt;mvn clean install&lt;/pre&gt; 
Moreover to generate the documentation just execute the following Maven command (or take the one provided in the repository on Github). 
&lt;pre&gt;mvn clean&amp;nbsp;plugin:xdoc javadoc:javadoc jxr:jxr site
&lt;/pre&gt; 
== Goals  ==

The plugin provides a set of Maven goals that allow different actions. 

{| width=&quot;800&quot; border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;
|-
| '''Goal''' 
| '''Description'''
|-
| &lt;code&gt;virgo:start&lt;/code&gt; 
| Starts a Virgo instance by executing the provided startup script. &lt;br&gt; 
*''This goal has only been tested on Windows. Feedback for Unix/Mac is appreciated.'' 
*''When executing this goal from within Eclipse (at least on Windows) a console view keeps running even though the build itself has succeeded. Once the opened window has been closed (shutting down the server will not be sufficient) the console view will finish as well.'' 
*''Currently no starting arguments are provided. Once people start asking for this feature it will be added.''

|-
| &lt;code&gt;virgo:shutdown&lt;/code&gt; 
| Stops a running Virgo instance.
|-
| &lt;code&gt;virgo:immediateShutdown&lt;/code&gt; 
| Stops a running Virgo instance immediately.
|-
| &lt;code&gt;virgo:deploy&lt;/code&gt; 
| Deploys an OSGi bundle to a running Virgo instance.
|-
| &lt;code&gt;virgo:undeploy&lt;/code&gt; 
| Undeploys an OSGi bundle from a running Virgo instance.
|-
| &lt;code&gt;virgo:refresh&lt;/code&gt; 
| Refreshs an already installed module on a running Virgo instance.
|-
| &lt;code&gt;virgo:bundleRefresh&lt;/code&gt; 
| Refreshs an already installed OSGi bundle on a running Virgo instance.
|}

== Simple example POM  ==

Once the plugin has been build and installed in the local Maven repository it can be used within a Maven project. Following is a simple example of a pom file that uses the Maven plugin.&amp;nbsp; 
&lt;pre&gt;&amp;lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&amp;gt;
	&amp;lt;modelVersion&amp;gt;4.0.0&amp;lt;/modelVersion&amp;gt;
	&amp;lt;groupId&amp;gt;org.example.osgi&amp;lt;/groupId&amp;gt;
	&amp;lt;artifactId&amp;gt;test-bundle&amp;lt;/artifactId&amp;gt;
	&amp;lt;version&amp;gt;0.0.1-SNAPSHOT&amp;lt;/version&amp;gt;
	&amp;lt;packaging&amp;gt;bundle&amp;lt;/packaging&amp;gt;
	&amp;lt;name&amp;gt;OSGi Test Bundle&amp;lt;/name&amp;gt;	
	&amp;lt;properties&amp;gt;
		&amp;lt;project.build.sourceEncoding&amp;gt;UTF-8&amp;lt;/project.build.sourceEncoding&amp;gt;
	&amp;lt;/properties&amp;gt;
	&amp;lt;build&amp;gt;
		&amp;lt;plugins&amp;gt;
			&amp;lt;plugin&amp;gt;
				&amp;lt;groupId&amp;gt;org.apache.felix&amp;lt;/groupId&amp;gt;
				&amp;lt;artifactId&amp;gt;maven-bundle-plugin&amp;lt;/artifactId&amp;gt;
				&amp;lt;version&amp;gt;2.3.6&amp;lt;/version&amp;gt;
				&amp;lt;extensions&amp;gt;true&amp;lt;/extensions&amp;gt;
				&amp;lt;configuration&amp;gt;
					&amp;lt;instructions&amp;gt;
						&amp;lt;Bundle-SymbolicName&amp;gt;${project.groupId}.${project.artifactId}&amp;lt;/Bundle-SymbolicName&amp;gt;
						&amp;lt;Bundle-Name&amp;gt;${project.name}&amp;lt;/Bundle-Name&amp;gt;
						&amp;lt;Bundle-Version&amp;gt;${project.version}&amp;lt;/Bundle-Version&amp;gt;
					&amp;lt;/instructions&amp;gt;
				&amp;lt;/configuration&amp;gt;
			&amp;lt;/plugin&amp;gt;
			&amp;lt;plugin&amp;gt;
				&amp;lt;groupId&amp;gt;net.flybyte.virgo&amp;lt;/groupId&amp;gt;
				&amp;lt;artifactId&amp;gt;virgo-maven-plugin&amp;lt;/artifactId&amp;gt;
				&amp;lt;version&amp;gt;1.0.0&amp;lt;/version&amp;gt;
				&amp;lt;configuration&amp;gt;
					&amp;lt;virgoRoot&amp;gt;C:/Java/virgo-tomcat-server-3.0.2.RELEASE&amp;lt;/virgoRoot&amp;gt;
				&amp;lt;/configuration&amp;gt;
			&amp;lt;/plugin&amp;gt;
		&amp;lt;/plugins&amp;gt;
	&amp;lt;/build&amp;gt;
&amp;lt;/project&amp;gt;
&lt;/pre&gt; 
More examples can be found in the documentation. Following are some exemplary Maven commands.
&lt;pre&gt;mvn virgo:start &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;-- will start a Virgo instance
mvn clean package virgo:deploy &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;-- will create an artifact and deploy it to Virgo&lt;/pre&gt; 

= Importing Virgo Projects into Eclipse =

See [http://wiki.eclipse.org/Virgo/Committers#Eclipse_Setup Eclipse Setup] under the Committers tab.

= FAQ=

* '''How do I turn on (or turn off) automatic Manifest generation? (Bundlor)'''

Bundlor is not used by default, you must create you own template file and then turn on incremental manifest generation. Right-click your Virgo project, select the Virgo subcategory from the context menu and select Enable (or Disable) Incremental Generation of MANIFEST.MF File. You can also modify this setting from the Overview page of the Bundle Manifest Editor, under the Bundle Actions section.

* '''Sometimes I'd like to automatically update my Manifest without having to turn on the automatic Manifest setting. How can I do this?'''

Right-click your Virgo project, select the Virgo subcategory from the context menu and select Run Generation of MANIFEST.MF File. This command has a keybinding that you may customize through Eclipse's Keys preferences. You can also perform an automatic update of the Manifest from the Overview page of the Bundle Manifest Editor, under the Bundle Actions section.

* '''Automatic Manifest generation doesn't appear to picking up changes to my source files.'''

Sometimes Manifest generation may behave differently depending on whether the tools are configured to scan source folders or to scan output folders. To modify this setting right-click your Virgo project, select properties and select the Virgo -&gt; Manifest Generation subcategory. If Manifest generation isn't working correctly for you, uncheck the &quot;Scan output folders instead of source folders to generate MANIFEST.MF&quot; setting and re-run the Manifest generation. If your Manifest is not being properly generated under either setting, please file a bug.

[[image:virgo-manifest-generation.png]]

* '''My Virgo project is validating its dependencies against the wrong Virgo runtime! How do I manage server runtimes for my Virgo projects?'''

If you've deployed your Virgo projects to multiple Virgo runtimes the tools will associate the project with each runtime, but will only validate against one runtime. In order to manage which Virgo runtime your bundle dependencies are validated against, right-click on the project, select Properties and select the Targeted Runtimes category. From this dialog you can give priority to a particular Virgo runtime.

[[image:virgo-targeted-runtimes.png]]

* '''How do I deploy a Plan with the Virgo tools?'''

Deploying a Plan works much the same way as deploying a Bundle or PAR from the tools. Unfortunately, the tools only handle Plan deployment correctly when the Plan refers to items already in Virgo's watched repository directories. If you try to deploy a Plan that references a project in the Eclipse workspace, the tools will fail. One workaround is to copy your workspace bundle(s) into repository/usr or some other watched repository directory. A discussion of this bug and other workarounds is available at https://bugs.eclipse.org/bugs/show_bug.cgi?id=379765

* '''How do I create a Web Application Bundle?'''

To create a web application bundle choose to create a normal bundle project, but on the Bundle Content panel select the additional property entitled &quot;Web Application Bundle&quot;. On the Bundle Properties panel enter a suitable context path for the application as the Web-ContextPath.

* '''How do I export a Web Application Bundle (WAB)? Export -&gt; Bundle Project produces an incorrect product.'''

To export a WAB invoke Export -&gt; Web -&gt; WAR File

* '''Virgo Jetty Server (VJS) does not startup correctly and I see a 503 error when I go to http://localhost:8080/admin'''

This can happen after starting VJS clean because VJS is looking for a directory at $KERNEL_HOME/work/tmp but no tmp directory exists. A workaround is to start VJS from the command line without the -clean command, which will create the tmp directory. VJS can then be used from the tools. This bug and workaround are documented at https://bugs.eclipse.org/bugs/show_bug.cgi?id=384288  

* '''Can I get a deeper look into the state of the server from the Virgo Tools?'''

Yes! If you double-click a Virgo server runtime in the Servers view, you'll open up the server editor, with several pages of information. The Repository, Bundle Overview, Bundle Dependency Graph, and Server Console pages all give valuable insight into the state of the server. The Virgo perspective also provides several views into the Virgo Repository, Virgo Properties and Virgo Logs. See the Virgo Tooling Guide for more information.

* '''I want to install Virgo Tools. Should I install all of this neat looking stuff under Virgo Add-ons?'''

We really don't recommend doing so (see [[#Install_Virgo]]). Select only Virgo Tooling and Eclipse will take care of installing anything the tooling relies on.

* '''Can I use the Virgo Tools with traditional PDE/Equinox Bundles?'''

Deploying PDE/Equinox Bundles to Virgo Web Server are not yet supported yet, although exporting the bundles (as Eclipse Plug-in JARs) and manually deploying to Virgo Web Server works. Please show your support on [https://bugs.eclipse.org/bugs/show_bug.cgi?id=329198 Bugzilla #329198].

[[Category:Virgo]] [[Category:EclipseRT]]</rev></revisions></page></pages></query></api>