Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Virgo/Tooling

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
  • PDE Bundle projects
  • Par projects
  • Plan Projects
  • Web Bundles
  • Deployment to a Virgo Server in the server view.

Since version 1.5 Virgo Tools support deploying PDE projects to Virgo. It's possible to develop for Virgo using the Eclipse Plug-in Development Environment, provided that PDE Bundle projects are created using the dedicated Virgo Tools wizard. Please refer to the official documentation for further details.

Installation

Install Eclipse

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

The Virgo Tools highly recommend using a recent Eclipse SimRel version. The current version of the Virgo Tools, 1.5.2, requires Eclipse SimRel 2019-06 minimum and has been tested up to Eclipse SimRel 2020-03.

If you are forced to use an older versions of Eclipse, you may try Virgo Tools 1.5.1 which are known to work with:

  • Eclipse Luna 4.4
  • Eclipse Mars 4.5
  • Eclipse Neon 4.6
  • Eclipse Oxygen 4.7

Note that for Eclipse Photon you will have to follow a manual procedure explained in bug 537017.

Install Virgo Tools

  1. Select Help>Install New Software..
  2. Enter one of the Virgo update sites below.
  3. Select "Virgo Tools" feature and click install.

Note: Select only Virgo Tooling. This is a composite site, and the other features are not designed to work within the Eclipse IDE.

VirgoInstall.png

Update Sites

Release
http://download.eclipse.org/virgo/release/tooling (Recommended)
Milestone
http://download.eclipse.org/virgo/milestone/tooling
Snapshot
http://download.eclipse.org/virgo/snapshot/tooling

Note that in order to install Virgo Tools on versions of Eclipse older than Eclipse SimRel 2019-6 in addition to the above update sites you may have to add the following update sites to the list of known update sites in Preferences -> Install/Updates -> Available Software Sites and you will need to check Contact all update sites during install to find required software

Known Issues

Server Versions

The Virgo Tools support Virgo Server 3.5 or newer.

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 Github 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.

mvn clean install

Moreover to generate the documentation just execute the following Maven command (or take the one provided in the repository on Github).

mvn clean plugin:xdoc javadoc:javadoc jxr:jxr site

Goals

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

Goal Description
virgo:start Starts a Virgo instance by executing the provided startup script.
  • 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.
virgo:shutdown Stops a running Virgo instance.
virgo:immediateShutdown Stops a running Virgo instance immediately.
virgo:deploy Deploys an OSGi bundle to a running Virgo instance.
virgo:undeploy Undeploys an OSGi bundle from a running Virgo instance.
virgo:refresh Refreshs an already installed module on a running Virgo instance.
virgo:bundleRefresh 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. 

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>org.example.osgi</groupId>
	<artifactId>test-bundle</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>bundle</packaging>
	<name>OSGi Test Bundle</name>	
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<version>2.3.7</version>
				<extensions>true</extensions>
				<configuration>
					<instructions>
						<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
						<Bundle-Name>${project.name}</Bundle-Name>
						<Bundle-Version>${project.version}</Bundle-Version>
					</instructions>
				</configuration>
			</plugin>
			<plugin>
				<groupId>net.flybyte.virgo</groupId>
				<artifactId>virgo-maven-plugin</artifactId>
				<version>1.0.0</version>
				<configuration>
					<virgoRoot>C:/Java/virgo-tomcat-server-3.0.2.RELEASE</virgoRoot>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

More examples can be found in the documentation. Following are some exemplary Maven commands.

mvn virgo:start                             <-- will start a Virgo instance
mvn clean package virgo:deploy              <-- will create an artifact and deploy it to Virgo

Importing Virgo Projects into Eclipse

See 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 be 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 -> Manifest Generation subcategory. If Manifest generation isn't working correctly for you, uncheck the "Scan output folders instead of source folders to generate MANIFEST.MF" setting and re-run the Manifest generation. If your Manifest is not being properly generated under either setting, please file a bug.

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.

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 "Web Application Bundle". 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 -> Bundle Project produces an incorrect product.

To export a WAB invoke Export -> Web -> WAR File

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?

Yes, starting from 1.5+ Virgo Tools natively support PDE. Please refer to the documentation for details.

Copyright © Eclipse Foundation, Inc. All Rights Reserved.