-
-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--- Signed-off-by: Peter Kriens <[email protected]> Signed-off-by: Peter Kriens <[email protected]>
- Loading branch information
Showing
471 changed files
with
194,432 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,398 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" ng-app="jpm"> | ||
|
||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link href="/css/style.css" rel="stylesheet" /> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> | ||
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> | ||
<script src="/js/releases.js"></script> | ||
|
||
<!-- Begin Jekyll SEO tag v2.8.0 --> | ||
<title>Best practices | bnd</title> | ||
<meta name="generator" content="Jekyll v3.9.3" /> | ||
<meta property="og:title" content="Best practices" /> | ||
<meta property="og:locale" content="en_US" /> | ||
<meta name="description" content="Workspaces" /> | ||
<meta property="og:description" content="Workspaces" /> | ||
<meta property="og:site_name" content="bnd" /> | ||
<meta property="og:type" content="website" /> | ||
<meta name="twitter:card" content="summary" /> | ||
<meta property="twitter:title" content="Best practices" /> | ||
<script type="application/ld+json"> | ||
{"@context":"https://schema.org","@type":"WebPage","description":"Workspaces","headline":"Best practices","url":"/chapters/140-best-practices.html"}</script> | ||
<!-- End Jekyll SEO tag --> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<style> | ||
body { | ||
counter-reset: h1 6; | ||
} | ||
</style> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</head> | ||
|
||
|
||
<body> | ||
|
||
|
||
<ul class="container12 menu-bar" style="display:flex;align-items:center"> | ||
<li span=8><a class=menu-link href="/"><img | ||
class=menu-logo src="/img/bnd-80x40-white.png"></a> | ||
<a href="/chapters/110-introduction.html">Intro | ||
</a><a href="/chapters/800-headers.html">Headers | ||
</a><a href="/chapters/825-instructions-ref.html">Instructions | ||
</a><a href="/chapters/855-macros-ref.html">Macros | ||
</a><a href="/chapters/400-commands.html">Commands | ||
</a><div class="releases"> | ||
<button class="dropbtn"><span class="fa fa-bars"></span> master</button> | ||
<div class="dropdown-content"></div> | ||
</div> | ||
<li span=4> | ||
<div class="search-container"> | ||
<form method="get" id="search" action="https://google.com/search" target="_blank"> | ||
<input type="hidden" name="as_q" value="site:bndtools.org OR site:bnd.discourse.group"/> | ||
<input type="text" name="q" placeholder="Search…" aria-label="Search https://google.com for bnd specific"/> | ||
<button type="submit" class="fa fa-search"></button> | ||
</form> | ||
</div> | ||
</ul> | ||
<div class=menu-link span=0><script> | ||
window.onload = function() { | ||
var currentURL = window.location.href; | ||
var regex = /https:\/\/bnd.bndtools.org\/(.*\.html)/; | ||
var matches = currentURL.match(regex); | ||
var filePath = matches[1]; | ||
if (filePath.includes("/")) | ||
filePath = "_" + filePath; | ||
var markdownFileURL = 'https://github.com/bndtools/bnd/blob/master/docs/' + filePath.replace(".html", ".md"); | ||
var repoLink = document.getElementById('repo-link'); | ||
repoLink.href = markdownFileURL; | ||
}; | ||
</script> | ||
|
||
<a id="repo-link" href="https://github.com/bndtools/bnd/docs/" target="_"><img | ||
style="position:absolute;top:0;right:0;margin:0;padding:0;z-index:100" | ||
src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" | ||
alt="Fork me on GitHub" | ||
data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a> | ||
</div> | ||
|
||
|
||
|
||
|
||
|
||
<ul class=container12> | ||
<li span=3> | ||
<div> | ||
<ul class="side-nav"> | ||
|
||
|
||
<li><a href="/chapters/110-introduction.html">Introduction</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/120-install.html">How to install bnd</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/123-tour-workspace.html">Guided Tour</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/125-tour-features.html">Guided Tour Workspace & Projects</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/130-concepts.html">Concepts</a> | ||
|
||
|
||
|
||
<li class=selected>Best practices | ||
|
||
|
||
|
||
<li><a href="/chapters/150-build.html">Build</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/155-project-setup.html">Project Setup</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/160-jars.html">Generating JARs</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/170-versioning.html">Versioning</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/180-baselining.html">Baselining</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/200-components.html">Service Components</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/210-metatype.html">Metatype</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/220-contracts.html">Contracts</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/230-manifest-annotations.html">Bundle Annotations</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/235-accessor-properties.html">Accessor Properties</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/240-spi-annotations.html">SPI Annotations</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/250-resolving.html">Resolving Dependencies</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/300-launching.html">Launching</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/305-startlevels.html">Startlevels</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/310-testing.html">Testing</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/315-launchpad-testing.html">Testing with Launchpad</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/320-packaging.html">Packaging Applications</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/330-jpms.html">JPMS Libraries</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/390-wrapping.html">Wrapping Libraries to OSGi Bundles</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/395-generating-documentation.html">Generating Documentation</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/400-commands.html">Commands</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/600-developer.html">For Developers</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/650-windows.html">Tips for Windows users</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/700-tools.html">Tools bound to bnd</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/790-reference.html">Reference</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/800-headers.html">Headers</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/820-instructions.html">Instruction Reference</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/825-instructions-ref.html">Instruction Index</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/850-macros.html">Macro Reference</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/855-macros-ref.html">Macro Index</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/870-plugins.html">Plugins</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/875-external-plugins.html">External Plugins</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/880-settings.html">Settings</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/900-errors.html">Errors</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/910-warnings.html">Warnings</a> | ||
|
||
|
||
|
||
<li><a href="/chapters/920-faq.html">Frequently Asked Questions</a> | ||
|
||
|
||
</ul> | ||
|
||
</div> | ||
|
||
<li span=9> | ||
<div class=notes-margin> | ||
|
||
<h1> Best practices | ||
</h1> | ||
<h2 id="workspaces">Workspaces</h2> | ||
|
||
<p>The idea of a workspace is that it is cohesive. It contains a set of shared bundles and some of those bundles are exported to a repository. Other bundles are imported from repositories. This is the basic model of modularity.</p> | ||
|
||
<p>This strongly implies that you should NOT share cnf between workspace, just like you should not share private fields from classes nor private classes from packages. So the idea is that your organizations has a number of workspaces that contain the code that has a strong relation. For example a product, your company service APIs, or shared base libraries. Since all these projects are in one workspace you get a lot of ease of use like refactoring and immediate feedback.</p> | ||
|
||
<p>That said, there is often a desire to have some of the information, like the repositories in a shared place because you do not want to maintain it multiple times. Since bnd is completely based on inherited properties this is not that hard. The top of the properties are coming from the cnf/build.bnd file. Since this is a bnd file, you can actually include another bnd file there. Since this can be included via a URL, you can refer it to a file on your git repository. For convenience, you could make it refer to master but a better way is to make it refer to an actual commit. The reason is that if you checkout your project 5 years from now, it is unlikely that your build will be ok with the latest version of the included bnd file.</p> | ||
|
||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>build.bnd: | ||
|
||
-include: https://examplegit.com/foo/bar/master/shared/shared.bnd | ||
</code></pre></div></div> | ||
|
||
<p>A more defined way to handle this long term versioning problem is to use git modules. They have a bad name but as far as I understand their bad name is because people don’t like that they are not automatically updated, which is exactly what you want when you want to build your project 5 years from now. Git modules require an explicit command to upgrade it to the latest or another version. The parent git repository stores the commit at which it is linked. With git modules you could make a subdirectory in cnf and then include a shared file from there:</p> | ||
|
||
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cnf | ||
shared/ | ||
.git/ | ||
shared.bnd | ||
build.bnd | ||
|
||
build.bnd: | ||
-include shared/shared.bnd | ||
</code></pre></div></div> | ||
|
||
<p>So to summarize, share workspaces, not projects. Use continuous integration that publishes your bundles to a repository that is shared with all. Share one bnd file with a git module.</p> | ||
|
||
|
||
</div> | ||
</ul> | ||
|
||
|
||
<nav class=next-prev> | ||
<a href='/chapters/130-concepts.html'></a> <a href='/chapters/150-build.html'></a> | ||
</nav> | ||
<footer class="container12" style="border-top: 1px solid black;padding:10px 0"> | ||
<ul span=12 row> | ||
<li span=12> | ||
<ul> | ||
<li><a href="/">GitHub</a> | ||
</ul> | ||
</ul> | ||
</footer> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.