forked from bndtools/bndtools.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfaq.html
176 lines (159 loc) · 11.7 KB
/
faq.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bndtools</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content>
<meta name="author" content>
<!-- Le styles -->
<link href="css/bootstrap.css" rel="stylesheet">
<style type="text/css">
body {
padding-top: 60px;
padding-bottom: 40px;
}
.sidebar-nav {
padding: 9px 0;
}
</style>
<!--<link href="css/bootstrap-responsive.css" rel="stylesheet">-->
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="images/favicon.ico">
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="./index.html"><img src="./images/logo-topbar.png"></img></a>
<!--
<div class="btn-group pull-right">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
<i class="icon-user"></i> Username
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href="#">Profile</a></li>
<li class="divider"></li>
<li><a href="#">Sign Out</a></li>
</ul>
</div>
-->
<div class="nav-collapse">
<ul class="nav">
<li><a href="./index.html">Home</a></li>
<li><a href="./installation.html">Install</a></li>
<li><a href="./tutorial.html">Tutorial</a></li>
<li><a href="./help.html">Get Help</a></li>
<li><a href="./faq.html">FAQ</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span2">
<div class="well sidebar-nav">
<ul class="nav nav-list">
<li><a href="./">Home</a></li>
<li><a href="./licence.html">Licence</a></li>
<li><a href="./community.html">Get Involved</a></li>
<li><a href="./training.html">Training</a></li>
<li><a href="./#donate">Donate</a></li>
<li class="divider"></li>
<li class="nav-header">Documentation</li>
<li><a href="./installation.html">Installation</a></li>
<li><a href="./tutorial.html">Tutorial</a></li>
<li><a href="./concepts.html">Concepts Guide</a></li>
<li><a href="./faq.html">FAQ</a></li>
<li><a href="./whatsnew.html">What's New</a></li>
<li class="divider"></li>
<li class="nav-header">Development</h1>
<li><a class="external-left" href="https://github.com/bndtools/bndtools/issues">Bug Reports</a></li>
<li><a class="external-left" href="https://bndtools.ci.cloudbees.com/job/bndtools.master/">Build Status</a></li>
<li><a href="./development.html">Developer Guide</a></li>
<li><a href="./acknowledge.html">Acknowledgements</a></li>
</ul>
</div><!--/.well -->
</div><!--/span-->
<div class="span10">
<div class="hero-unit">
<h1>Bndtools FAQ</h1>
<p>Frequently Asked Questions</p>
</div>
<h1 id="TOC">Table of Contents</h1><ul>
<li><a href="#how-do-i-add-bundles-to-the-repository"><span class="toc-section-number">0.1</span> How Do I Add Bundles to the Repository?</a></li>
<li><a href="#how-do-i-remove-bundles-from-a-repository"><span class="toc-section-number">0.2</span> How Do I Remove Bundles from a Repository?</a></li>
<li><a href="#why-is-my-bundle-empty"><span class="toc-section-number">0.3</span> Why is My Bundle Empty?</a></li>
<li><a href="#whats-the-difference-between--include-and-include-resource"><span class="toc-section-number">0.4</span> What’s the Difference Between “-include” and “Include-Resource”?</a></li>
<li><a href="#how-can-i-configure-the-system-bundle-exports"><span class="toc-section-number">0.5</span> How Can I Configure the System Bundle Exports?</a></li>
<li><a href="#how-can-i-depend-on-a-plain-jar-file-at-build-time"><span class="toc-section-number">0.6</span> How Can I Depend on a Plain JAR File at Build Time?</a></li>
</ul>
<h2 id="how-do-i-add-bundles-to-the-repository"><a href="#TOC"><span class="header-section-number">0.1</span> How Do I Add Bundles to the Repository?</a></h2>
<p>There are several ways to add external bundles into your repository in order to make them available in your projects. The easiest way is to drag-and-drop from your native file management application (i.e. Windows Explorer, Mac Finder, etc) into the <strong>Repositories</strong> view in Bndtools. Note that you need to drop it onto a specific repository entry: usually the “Local Repository”. Note that you can multi-select many bundle files and drag/drop them at the same time.</p>
<div class="figure">
<img src="./images/faq/01.png"></img><p class="caption"></p>
</div>
<p>Importing the bundles this way is better than directly modifying the contents of the <code>cnf/repo</code> directory, since Bndtools is immediately aware of the new bundles and regenerates the OBR index for the repository.</p>
<p><strong>NB:</strong> not all repository types support adding bundles! For example, the <code>OBR</code> repository type is based on an index file that may be anywhere local or remote; Bndtools would not know where to put the new bundle or how to update the index. However the following repository types <em>do</em> support additions:</p>
<ul>
<li><code>LocalOBR</code></li>
<li><code>FileRepo</code></li>
</ul>
<h2 id="how-do-i-remove-bundles-from-a-repository"><a href="#TOC"><span class="header-section-number">0.2</span> How Do I Remove Bundles from a Repository?</a></h2>
<p>Unfortunately the current repository API does not support a generic way to remove bundles. We plan to update this API, but for now it is necessary to remove the bundles manually from the filesystem.</p>
<p>For repositories of type <code>LocalOBR</code> perform the following steps:</p>
<ol style="list-style-type: decimal">
<li>Delete the bundle file from <code><repo_dir>/<bsn></code>. If you want to delete all versions of the bundle, then also delete the <code><bsn></code> directory itself (i.e., do not leave an empty directory).</li>
<li>Delete the OBR index file, <code><repo_dir>/repository.xml</code>.</li>
<li>Touch the <code>cnf/build.bnd</code> file. This causes the index file to be regenerated and the repository contents to be refreshed.</li>
</ol>
<p>For repositories of type <code>FileRepo</code>, perform the same steps except for deleting the OBR index (which will not exist anyway).</p>
<h2 id="why-is-my-bundle-empty"><a href="#TOC"><span class="header-section-number">0.3</span> Why is My Bundle Empty?</a></h2>
<p>In Bndtools the contents of a bundle must be defined explicitly; if the contents are not defined then the bundle will be empty. Bundle contents are defined using the following three instructions (follow links to the bnd documentation for these instructions):</p>
<ul>
<li><a href="http://www.aqute.biz/Bnd/Format#private-package"><code>Private-Package</code></a> defines Java packages to be included in the bundle but not exported.</li>
<li><a href="http://www.aqute.biz/Bnd/Format#export-package"><code>Export-Package</code></a> defines Java packages to be both included in the bundle <em>and</em> exported.</li>
<li><a href="http://www.aqute.biz/Bnd/Format#include-resource"><code>Include-Resource</code></a> defines non-Java resource files (e.g. images, XML files etc) to be included in the bundle.</li>
</ul>
<p>Note that both <code>Private-Package</code> and <code>Export-Package</code> may be edited using the <em>Contents</em> tab of the GUI editor. There is currently no GUI assistance for the <code>Include-Resource</code> instruction so it must be entered using the <em>Source</em> tab.</p>
<h2 id="whats-the-difference-between--include-and-include-resource"><a href="#TOC"><span class="header-section-number">0.4</span> What’s the Difference Between “-include” and “Include-Resource”?</a></h2>
<p>The <a href="http://www.aqute.biz/Bnd/Format#directives"><code>-include</code></a> instruction is used to include a set of bnd instructions from another <code>.bnd</code> file into the current <code>.bnd</code> file. This can be useful if there are common settings or instructions used in multiple places.</p>
<p>The <a href="http://www.aqute.biz/Bnd/Format#include-resource"><code>Include-Resource</code></a> instruction tells bnd to include a set of non-Java resources (e.g. images, XML files etc) in the output bundle.</p>
<h2 id="how-can-i-configure-the-system-bundle-exports"><a href="#TOC"><span class="header-section-number">0.5</span> How Can I Configure the System Bundle Exports?</a></h2>
<p>To add extra packages to the exports of the OSGi System Bundle, use the <code>-runsystempackages</code> instruction to your run configuration file. For example:</p>
<pre><code>-runsystempackages: sun.reflect</code></pre>
<p>You can also add library JARs to the Java application “classpath” using the <code>-runpath</code> instruction, which would then allow you to expose the contents of those libraries via system bundle exports:</p>
<pre><code>-runpath: jide-oss-1.0.0.jar
-runsystempackages: com.jidesoft.swing, com.jidesoft.animation</code></pre>
<p>Note that using the <code>-runsystempackages</code> instruction is equivalent to setting the OSGi property <code>org.osgi.framework.system.packages.extra</code>; however it is better to use <code>-runsystempackages</code> because then the OBR resolver inside Bndtools will take account of the availability of those packages during resolution.</p>
<h2 id="how-can-i-depend-on-a-plain-jar-file-at-build-time"><a href="#TOC"><span class="header-section-number">0.6</span> How Can I Depend on a Plain JAR File at Build Time?</a></h2>
<p>Sometimes it is useful to add a plain JAR file to the build-time dependencies of a project. For example we may want to use a “pure” API JAR to build against, but use a different artefact at runtime. Or we may be planning to embed the dependency in our bundle.</p>
<p>Plain JAR files should be added to the Build Path using the <code>version=file</code> attribute. Unfortunately there is currently no GUI support for this attribute so you will have to edit the <em>Source</em> tab:</p>
<pre><code>-buildpath: libs/servlet-api-3.0.jar;version=file</code></pre>
<p>Note that this approach is better than using Eclipse’s <em>Add to Build Path</em> action, because the latter will not be visible when the project is built offline using ANT; i.e. a project that compiles in Eclipse may not compile in ANT. Using the <code>-buildpath</code> approach ensures that both Eclipse and ANT build the project in exactly the same way.</p>
</div><!--/span-->
</div><!--/row-->
</div><!--/.fluid-container-->
<footer>
<div class="well">
<p>© <a href="mailto:[email protected]">Neil Bartlett</a> 2011. Built with <a href="http://twitter.github.com/bootstrap/">Bootstrap</a> and <a href="http://jaspervdj.be/hakyll/index.html">Hakyll</a>.</p>
</div>
</footer>
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>