Maven plugin | ||
---|---|---|
![]() |
![]() |
|
Migration | Importing Virgo Projects into Eclipse |
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.
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
The plugin provides a set of Maven goals that allow different actions.
Goal | Description |
<code>virgo:start</code> | Starts a Virgo instance by executing the provided startup script.
|
<code>virgo:shutdown</code> | Stops a running Virgo instance. |
<code>virgo:immediateShutdown</code> | Stops a running Virgo instance immediately. |
<code>virgo:deploy</code> | Deploys an OSGi bundle to a running Virgo instance. |
<code>virgo:undeploy</code> | Undeploys an OSGi bundle from a running Virgo instance. |
<code>virgo:refresh</code> | Refreshs an already installed module on a running Virgo instance. |
<code>virgo:bundleRefresh</code> | Refreshs an already installed OSGi bundle on a running Virgo instance. |
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.6</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
![]() |
![]() |
![]() |
Migration | Importing Virgo Projects into Eclipse |