287 lines
20 KiB
HTML
287 lines
20 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
|
||
|
||
|
||
|
||
<!--<link rel="shortcut icon" href="https://www.openhab.org/favicon.png"></link>-->
|
||
<title>Target platform - openHAB 2 - Empowering the Smart Home</title>
|
||
|
||
<!-- CSS -->
|
||
<link type="text/css" rel="stylesheet" href="/v2.1/css/materialize.css" media="screen,projection" />
|
||
<link type="text/css" rel="stylesheet" href="/v2.1/css/pygments-jekyll-style.css" />
|
||
<link type="text/css" rel="stylesheet" href="/v2.1/css/styles.css" />
|
||
<link type="text/css" rel="stylesheet" href="/v2.1/css/openhab.css" />
|
||
<link type="text/css" rel="stylesheet" href="/v2.1/css/collapsible.css" />
|
||
|
||
<!-- Font -->
|
||
<link type="text/css" rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
|
||
<link type="text/css" rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:300,400,700" />
|
||
<link rel="canonical" href="http://docs.openhab.org/developers/prerequisites/targetplatform.html" />
|
||
<script type="text/javascript">var gaProperty = 'UA-47717934-3';var disableStr = 'ga-disable-' + gaProperty;if (document.cookie.indexOf(disableStr + '=true') > -1) {window[disableStr] = true;}</script>
|
||
<script>
|
||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||
ga('create', 'UA-47717934-3', 'auto');
|
||
ga('set', 'anonymizeIp', true);
|
||
ga('send', 'pageview');
|
||
</script>
|
||
</head>
|
||
|
||
|
||
<body class="documentation">
|
||
<div id="header" class="navbar-fixed">
|
||
<nav role="navigation">
|
||
<div class="container">
|
||
<div class="nav-wrapper">
|
||
<a href="/v2.1/index.html"><img id="logo" src="/images/logo.png" /></a>
|
||
<a href="#" data-activates="nav-mobile" class="button-collapse"><i class="material-icons">menu</i></a>
|
||
<ul class="right hide-on-med-and-down">
|
||
<li><a href="/tutorials/index.html">Tutorials</a></li>
|
||
<li><a href="/v2.1/introduction.html">User Manual</a></li>
|
||
<li><a href="/developers/index.html">Developer Guide</a></li>
|
||
<li><a target="_blank" href="https://community.openhab.org">Community Forum</a></li>
|
||
<li><a target="_blank" href="https://github.com/openhab">GitHub</a></li>
|
||
<li class="search"><i class="material-icons">search</i></li>
|
||
<li class="search">
|
||
<form method="GET" id="searchform" class="search-form" action="/search">
|
||
<input id="query" name="q" type="text" class="search-form-input" placeholder="search" />
|
||
</form>
|
||
</li>
|
||
</ul>
|
||
<ul id="nav-mobile" class="side-nav">
|
||
<li><a href="/v2.1/index.html">Home</a></li>
|
||
<li><a href="/tutorials/index.html">Tutorials</a></li>
|
||
<li><a href="/v2.1/introduction.html">User Manual</a></li>
|
||
<li><a href="/developers/index.html">Developer Guide</a></li>
|
||
<li><a target="_blank" href="https://community.openhab.org">Community Forum</a></li>
|
||
<li><a target="_blank" href="https://github.com/openhab">GitHub</a></li>
|
||
<li class="search">
|
||
<form method="GET" id="searchformmob" class="search-form" action="/search">
|
||
<input id="querymob" name="q" type="text" class="search-form-input" placeholder="search" />
|
||
</form>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</nav>
|
||
</div>
|
||
|
||
|
||
<section id="documentation" class="text content-wrapper">
|
||
<div class="container">
|
||
<div class="side-nav-wrapper">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<ul class="nav">
|
||
<li><a href="/v2.1/developers">Overview</a></li>
|
||
<li><a href="/v2.1/developers/contributing/contributing">Contributing</a></li>
|
||
<li><a href="/v2.1/developers/prerequisites/osgi.html">Prerequisites</a>
|
||
<ul>
|
||
<li><a href="/v2.1/developers/prerequisites/osgi.html">OSGi</a>
|
||
<ul>
|
||
<li><a href="/v2.1/developers/prerequisites/osgi.html">Overview</a></li>
|
||
<li><a href="/v2.1/developers/prerequisites/osgids.html">Declarative Services</a></li>
|
||
<li><a href="/v2.1/developers/prerequisites/osgitasks.html">Coding tasks</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a href="/v2.1/developers/prerequisites/tycho.html">Tycho</a></li>
|
||
<li><a href="/v2.1/developers/prerequisites/equinox.html">Equinox</a></li>
|
||
<li><a href="/v2.1/developers/prerequisites/targetplatform.html">Target Platform</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a href="/v2.1/developers/development/ide.html">Basics</a>
|
||
<ul>
|
||
<li><a href="/v2.1/developers/development/ide.html">IDE Setup</a></li>
|
||
<li><a href="/v2.1/developers/development/guidelines.html">Code Guidelines</a></li>
|
||
<li><a href="/v2.1/developers/development/bindings.html">Developing Bindings</a></li>
|
||
<li><a href="/v2.1/developers/development/logging.html">Logging</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a href="/v2.1/developers/development/evolution.html">Migration from 1.x</a>
|
||
<ul>
|
||
<li><a href="/v2.1/developers/development/evolution.html">Technical Differences</a></li>
|
||
<li><a href="/v2.1/developers/development/compatibilitylayer.html">Compatibility Layer</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
</div>
|
||
<div class="content">
|
||
|
||
<h1 id="target-platform">Target platform</h1>
|
||
|
||
<h2 id="introduction">Introduction</h2>
|
||
|
||
<p>The <em>Target Platform</em> is a collection of plug-ins which your workspace will be built and run against. It describes the platform that you are developing for. It can be used from <a href="tycho.html">Tycho Maven plugins</a> as well.</p>
|
||
|
||
<h2 id="target-definition">Target Definition</h2>
|
||
|
||
<p><em>Target platform</em> can be defined in a <em>target definition</em> file. <em>Target Definition is a way of determining the plug-ins to add to the state. You can have multiple target definitions, but only one definition can be selected as the target platform.</em> (Source: <a href="http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Fconcepts%2Ftarget.htm">Eclipse documentation</a>).</p>
|
||
|
||
<p>Target definitions are stored in a file with the extension <code class="highlighter-rouge">.target</code>. The openHAB target platform definition looks like this (it will be most probably changed when you read this article - for the latest version check in the <a href="https://github.com/openhab/openhab-distro/blob/master/launch/openhab.target">openhad-distro</a>):</p>
|
||
|
||
<div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp"><?xml version="1.0" encoding="UTF-8" standalone="no"?></span>
|
||
<span class="cp"><?pde version="3.8"?></span>
|
||
<span class="nt"><target</span> <span class="na">name=</span><span class="s">"openHAB Target Platform"</span> <span class="na">sequenceNumber=</span><span class="s">"156"</span><span class="nt">></span>
|
||
<span class="nt"><locations></span>
|
||
<span class="nt"><location</span> <span class="na">includeAllPlatforms=</span><span class="s">"false"</span> <span class="na">includeConfigurePhase=</span><span class="s">"false"</span> <span class="na">includeMode=</span><span class="s">"planner"</span> <span class="na">includeSource=</span><span class="s">"true"</span> <span class="na">type=</span><span class="s">"InstallableUnit"</span><span class="nt">></span>
|
||
<span class="nt"><unit</span> <span class="na">id=</span><span class="s">"org.eclipse.smarthome.feature.runtime.core.feature.group"</span> <span class="na">version=</span><span class="s">"0.0.0"</span><span class="nt">/></span>
|
||
<span class="nt"><unit</span> <span class="na">id=</span><span class="s">"org.eclipse.smarthome.feature.runtime.binding.feature.group"</span> <span class="na">version=</span><span class="s">"0.0.0"</span><span class="nt">/></span>
|
||
<span class="nt"><unit</span> <span class="na">id=</span><span class="s">"org.eclipse.smarthome.feature.runtime.console.equinox.feature.group"</span> <span class="na">version=</span><span class="s">"0.0.0"</span><span class="nt">/></span>
|
||
<span class="nt"><unit</span> <span class="na">id=</span><span class="s">"org.eclipse.smarthome.feature.runtime.rest.feature.group"</span> <span class="na">version=</span><span class="s">"0.0.0"</span><span class="nt">/></span>
|
||
<span class="nt"><unit</span> <span class="na">id=</span><span class="s">"org.eclipse.smarthome.feature.test.feature.group"</span> <span class="na">version=</span><span class="s">"0.0.0"</span><span class="nt">/></span>
|
||
<span class="nt"><repository</span> <span class="na">location=</span><span class="s">"http://download.eclipse.org/smarthome/updates-stable/"</span><span class="nt">/></span>
|
||
<span class="nt"></location></span>
|
||
<span class="nt"><location</span> <span class="na">includeAllPlatforms=</span><span class="s">"false"</span> <span class="na">includeConfigurePhase=</span><span class="s">"true"</span> <span class="na">includeMode=</span><span class="s">"planner"</span> <span class="na">includeSource=</span><span class="s">"true"</span> <span class="na">type=</span><span class="s">"InstallableUnit"</span><span class="nt">></span>
|
||
<span class="nt"><unit</span> <span class="na">id=</span><span class="s">"org.eclipse.equinox.sdk.feature.group"</span> <span class="na">version=</span><span class="s">"3.10.2.v20150204-1316"</span><span class="nt">/></span>
|
||
<span class="nt"><repository</span> <span class="na">location=</span><span class="s">"http://download.eclipse.org/releases/luna/201502271000"</span><span class="nt">/></span>
|
||
<span class="nt"></location></span>
|
||
<span class="nt"><location</span> <span class="na">includeAllPlatforms=</span><span class="s">"false"</span> <span class="na">includeConfigurePhase=</span><span class="s">"false"</span> <span class="na">includeMode=</span><span class="s">"planner"</span> <span class="na">includeSource=</span><span class="s">"true"</span> <span class="na">type=</span><span class="s">"InstallableUnit"</span><span class="nt">></span>
|
||
<span class="nt"><unit</span> <span class="na">id=</span><span class="s">"org.openhab.feature.p2.feature.group"</span> <span class="na">version=</span><span class="s">"0.0.0"</span><span class="nt">/></span>
|
||
<span class="nt"><repository</span> <span class="na">location=</span><span class="s">"https://dl.bintray.com/openhab/p2/openhab-core/2.0.0.x"</span><span class="nt">/></span>
|
||
<span class="nt"></location></span>
|
||
<span class="nt"><location</span> <span class="na">includeAllPlatforms=</span><span class="s">"false"</span> <span class="na">includeConfigurePhase=</span><span class="s">"true"</span> <span class="na">includeMode=</span><span class="s">"planner"</span> <span class="na">includeSource=</span><span class="s">"true"</span> <span class="na">type=</span><span class="s">"InstallableUnit"</span><span class="nt">></span>
|
||
<span class="nt"><unit</span> <span class="na">id=</span><span class="s">"org.openhab.deps.runtime.feature.group"</span> <span class="na">version=</span><span class="s">"0.0.0"</span><span class="nt">/></span>
|
||
<span class="nt"><unit</span> <span class="na">id=</span><span class="s">"org.openhab.deps.test.feature.group"</span> <span class="na">version=</span><span class="s">"0.0.0"</span><span class="nt">/></span>
|
||
<span class="nt"><repository</span> <span class="na">location=</span><span class="s">"https://dl.bintray.com/openhab/p2/openhab-deps-repo/1.0.6"</span><span class="nt">/></span>
|
||
<span class="nt"></location></span>
|
||
<span class="nt"><location</span> <span class="na">includeAllPlatforms=</span><span class="s">"false"</span> <span class="na">includeConfigurePhase=</span><span class="s">"false"</span> <span class="na">includeMode=</span><span class="s">"planner"</span> <span class="na">includeSource=</span><span class="s">"true"</span> <span class="na">type=</span><span class="s">"InstallableUnit"</span><span class="nt">></span>
|
||
<span class="nt"><unit</span> <span class="na">id=</span><span class="s">"net.minidev.asm"</span> <span class="na">version=</span><span class="s">"1.0.2"</span><span class="nt">/></span>
|
||
<span class="nt"><unit</span> <span class="na">id=</span><span class="s">"com.jayway.jsonpath.json-path"</span> <span class="na">version=</span><span class="s">"2.0.0"</span><span class="nt">/></span>
|
||
<span class="nt"><unit</span> <span class="na">id=</span><span class="s">"org.mapdb.mapdb"</span> <span class="na">version=</span><span class="s">"1.0.9"</span><span class="nt">/></span>
|
||
<span class="nt"><unit</span> <span class="na">id=</span><span class="s">"net.minidev.json-smart"</span> <span class="na">version=</span><span class="s">"2.1.1"</span><span class="nt">/></span>
|
||
<span class="nt"><repository</span> <span class="na">location=</span><span class="s">"http://eclipse.github.io/smarthome/third-party/target/repository"</span><span class="nt">/></span>
|
||
<span class="nt"></location></span>
|
||
<span class="nt"></locations></span>
|
||
<span class="nt"></target></span>
|
||
</code></pre></div></div>
|
||
|
||
<p>This file lists the different repositories (or also “update sites”), where the plug-ins are stored, and artifacts (“installable units”). To find more about update sites and installable units, take a look at the <a href="equinox.html#vi-p2">p2 short overview</a>.</p>
|
||
|
||
<h2 id="openhab-target-platform">openHAB target platform</h2>
|
||
|
||
<p>The <code class="highlighter-rouge">openHAB target platform</code> definition file is located in the <a href="https://github.com/openhab/openhab-distro/blob/master/launch/openhab.target">openhad-distro</a> repository. It contains all the external dependencies that are needed from the openHAB bundles.</p>
|
||
|
||
<h2 id="target-platform-editor-in-eclipse-ide">Target Platform Editor in Eclipse IDE</h2>
|
||
|
||
<p>Eclipse has a graphical interface for working with the target platform. It is located in the <code class="highlighter-rouge">Window</code> -> <code class="highlighter-rouge">Preferences</code> -> <code class="highlighter-rouge">Plug-in Development</code> -> <code class="highlighter-rouge">Target Platform</code>(See Fig.1).</p>
|
||
|
||
<h3 id="selecting">Selecting</h3>
|
||
|
||
<p>Depending on the repositories that you have selected in the installation process, you might have many options in this window. For openHAB development choose <code class="highlighter-rouge">openHAB Target Platform</code>. Make sure that it is checked and that it is “Active”.</p>
|
||
|
||
<p><img src="images/targetplatform.png" width="600" /><br />
|
||
Fig. 1. Target Platform dialog window</p>
|
||
|
||
<p>Hint! If for some reason the target platform that you want to use is missing from this list, the easiest way to add it is to close this window and simply drag and drop the target definition file into Eclipse. In the top right corner you will see a button <code class="highlighter-rouge">Set as current target platform</code>.</p>
|
||
|
||
<h3 id="reloading">Reloading</h3>
|
||
|
||
<p>During the development process, some projects might fail to build. There could be several possible problems in this case, two of them are related with the target platform:</p>
|
||
|
||
<ul>
|
||
<li>you have updated your plugins repository, but you have not updated the target platform in Eclipse (or the openhab-distro repository). The updated versions of the bundles require new dependencies that are not present in the current target platform that you are using;</li>
|
||
<li>your last update of the target platform in Eclipse has failed. In this case the content of the target platform may not be complete.</li>
|
||
</ul>
|
||
|
||
<p>In both cases the first thing to do is to check, if there are any problems with the target platform. Open the <code class="highlighter-rouge">Target Platform</code> window (See Fig.1). If you see a red cross in front of the <code class="highlighter-rouge">openHAB Target Platform</code> select it and click on <code class="highlighter-rouge">Edit</code>(Fig.2). A new window will pop up and Eclipse will try to connect to all repositories listed in the target definition file. If some of the plug-ins are not downloaded, it will download all missing bundles. This may take some minutes, so be patient. After the process has finished, if no problems were found, you can click on <code class="highlighter-rouge">Finish</code>.</p>
|
||
|
||
<p>You go back to the previous window and don’t forget to to click on <code class="highlighter-rouge">Reload</code>. After you save your actions with <code class="highlighter-rouge">OK</code> or <code class="highlighter-rouge">Apply</code>, Eclipse will try to rebuild all the projects in your workspace.</p>
|
||
|
||
<h3 id="editing">Editing</h3>
|
||
|
||
<p>You may wonder, why you have to edit the content of the target platform. If you are developing new binding, that requires a library that is not included in the target platform and you want to setup a quick test, it might be easier to add a folder with the required <code class="highlighter-rouge">.jar</code> file to your target platform.</p>
|
||
|
||
<p>You can edit the target definition file with any text editor that you want, but you might find it easier to edit the content of the target platform from the Eclipse UI. In order to do that, you have to:</p>
|
||
|
||
<ul>
|
||
<li>open the <code class="highlighter-rouge">Target Platform</code> dialog window (see Fig.1);</li>
|
||
<li>click on <code class="highlighter-rouge">Edit</code>(see Fig.2);</li>
|
||
<li>in the <code class="highlighter-rouge">Locations</code> tab select <code class="highlighter-rouge">Add..</code>;</li>
|
||
<li>Select <code class="highlighter-rouge">Folder</code> and follow the wizard.</li>
|
||
</ul>
|
||
|
||
<p><img src="images/edittarget.png" width="600" /><br />
|
||
Fig. 2. Edit Target Definition dialog window</p>
|
||
|
||
<h2 id="further-reading">Further Reading</h2>
|
||
|
||
<ul>
|
||
<li><a href="http://www.vogella.com/tutorials/EclipseTargetPlatform/article.html">http://www.vogella.com/tutorials/EclipseTargetPlatform/article.html</a></li>
|
||
<li><a href="https://wiki.eclipse.org/PDE/Target_Definitions">https://wiki.eclipse.org/PDE/Target_Definitions</a></li>
|
||
<li><a href="http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Fconcepts%2Ftarget.htm">http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Fconcepts%2Ftarget.htm</a></li>
|
||
</ul>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<footer>
|
||
<div class="container">
|
||
<div class="row">
|
||
<div class="col s12 m7">
|
||
Copyright © 2017 by the <a href="https://github.com/openhab">openHAB Community</a> and the <a href="http://www.openhabfoundation.org/">openHAB Foundation e.V.</a>
|
||
</div>
|
||
<div class="col s12 m5">
|
||
<ul class="list-inline right-align">
|
||
<li><a href="/imprint.html">Imprint</a></li>
|
||
<li><a href="/privacy.html">Privacy Policy</a></li>
|
||
<li><a href="http://www.openhab.org">openHAB Website</a></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</footer>
|
||
<script src="/v2.1/js/jquery.min.js"></script>
|
||
<script src="/v2.1/js/jquery.scrollme.min.js"></script>
|
||
<script src="/v2.1/js/jquery.sticky.js"></script>
|
||
<script src="/v2.1/js/materialize.min.js"></script>
|
||
<script src="/v2.1/js/init.js"></script>
|
||
|
||
<script>
|
||
$(document).ready(function () {
|
||
|
||
$('#oh2-checkbox').change(function () {
|
||
if (this.checked) $('.since-2x').show('slow');
|
||
else $('.source-oh2').hide('slow');
|
||
});
|
||
|
||
$('#oh1-checkbox').change(function () {
|
||
if (this.checked) $('.since-1x').show('slow');
|
||
else $('.source-oh1').hide('slow');
|
||
});
|
||
|
||
$('#legacy-checkbox').change(function () {
|
||
if (this.checked) $('.install-legacy').show('slow');
|
||
else $('.install-legacy').hide('slow');
|
||
});
|
||
|
||
$('#manual-checkbox').change(function () {
|
||
if (this.checked) $('.install-manual').show('slow');
|
||
else $('.install-manual').hide('slow');
|
||
});
|
||
|
||
});
|
||
</script>
|
||
|
||
</body>
|
||
</html>
|
||
|