搜索

此内容没有您所选择的语言版本。

7.2. Manual Deployment

download PDF

Overview

You can manually deploy and undeploy bundles by issuing commands at the Red Hat JBoss Fuse console.

Installing a bundle

Use the osgi:install command to install one or more bundles in the OSGi container. This command has the following syntax:
osgi:install [-s] [--start] [--help] UrlList
Where UrlList is a whitespace-separated list of URLs that specify the location of each bundle to deploy. The following command arguments are supported:
-s
Start the bundle after installing.
--start
Same as -s.
--help
Show and explain the command syntax.
For example, to install and start the bundle, ProjectDir/target/foo-1.0-SNAPSHOT.jar, enter the following command at the Karaf console prompt:
osgi:install -s file:ProjectDir/target/foo-1.0-SNAPSHOT.jar
Note
On Windows platforms, you must be careful to use the correct syntax for the file URL in this command. See Section A.1, “File URL Handler” for details.

Uninstalling a bundle

To uninstall a bundle, you must first obtain its bundle ID using the osgi:list command. You can then uninstall the bundle using the osgi:uninstall command (which takes the bundle ID as its argument).
For example, if you have already installed the bundle named A Camel OSGi Service Unit, entering osgi:list at the console prompt might produce output like the following:
...
[ 181] [Resolved   ] [            ] [       ] [   60] A Camel OSGi Service Unit (1.0.0.SNAPSHOT)
You can now uninstall the bundle with the ID, 181, by entering the following console command:
osgi:uninstall 181

URL schemes for locating bundles

When specifying the location URL to the osgi:install command, you can use any of the URL schemes supported by Red Hat JBoss Fuse, which includes the following scheme types:

Redeploying bundles automatically using dev:watch

In a development environment—where a developer is constantly changing and rebuilding a bundle—it is typically necessary to re-install the bundle multiple times. Using the dev:watch command, you can instruct Karaf to monitor your local Maven repository and re-install a particular bundle automatically, as soon as it changes in your local Maven repository.
For example, given a particular bundle—with bundle ID, 751—you can enable automatic redeployment by entering the command:
dev:watch 751
Now, whenever you rebuild and install the Maven artifact into your local Maven repository (for example, by executing mvn install in your Maven project), the Karaf container automatically re-installs the changed Maven artifact. For more details, see section "dev:watch, watch" in "Console Reference".
Important
Using the dev:watch command is intended for a development environment only. It is not recommended for use in a production environment.
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.