blob: d096357ba7fc22a4cd63896f13b0172880855047 [file] [log] [blame]
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 1.9.2 from src/site/markdown/bnd.md.vm at 2021-09-28
| Rendered using Apache Maven Fluido Skin 1.9
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="generator" content="Apache Maven Doxia Site Renderer 1.9.2" />
<title>Scripting Bundle Maven Plugin &#x2013; bnd Plugin</title>
<link rel="stylesheet" href="./css/apache-maven-fluido-1.9.min.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
<script src="./js/apache-maven-fluido-1.9.min.js"></script>
</head>
<body class="topBarDisabled">
<a href="https://github.com/apache/sling-scriptingbundle-maven-plugin">
<img style="position: absolute; top: 0; right: 0; border: 0; z-index: 10000;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png"
alt="Fork me on GitHub">
</a>
<div class="container-fluid">
<header>
<div id="banner">
<div class="pull-left"><a href="https://sling.apache.org/" id="bannerLeft"><img src="https://sling.apache.org/res/logos/sling.svg" alt="Apache Sling" width="123" height="63"/></a></div>
<div class="pull-right"><a href="https://apache.org/" id="bannerRight"><img src="https://sling.apache.org/res/logos/apache.png" alt="Apache"/></a></div>
<div class="clear"><hr/></div>
</div>
<div id="breadcrumbs">
<ul class="breadcrumb">
<li class=""><a href="https://sling.apache.org/" class="externalLink" title="Apache Sling">Apache Sling</a><span class="divider">/</span></li>
<li class=""><a href="https://sling.apache.org/components/" class="externalLink" title="Maven Plugins">Maven Plugins</a><span class="divider">/</span></li>
<li class=""><a href="index.html" title="Scripting Bundle Maven Plugin">Scripting Bundle Maven Plugin</a><span class="divider">/</span></li>
<li class="active ">bnd Plugin <a href="https://github.com/apache/sling-scriptingbundle-maven-plugin/tree/scriptingbundle-maven-plugin-0.5.0/src/site/markdown/bnd.md.vm"><img src="./images/accessories-text-editor.png" title="Edit" /></a></li>
<li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2021-09-28</li>
<li id="projectVersion" class="pull-right">Version: 0.5.0</li>
</ul>
</div>
</header>
<div class="row-fluid">
<header id="leftColumn" class="span2">
<nav class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">Overview</li>
<li><a href="index.html" title="Introduction"><span class="none"></span>Introduction</a></li>
<li><a href="plugin-info.html" title="Goals"><span class="none"></span>Goals</a></li>
<li><a href="usage.html" title="Usage"><span class="none"></span>Usage</a></li>
<li class="active"><a href="#"><span class="none"></span>Bnd Plugin</a></li>
<li class="nav-header">Project Documentation</li>
<li><a href="project-info.html" title="Project Information"><span class="icon-chevron-right"></span>Project Information</a></li>
<li><a href="project-reports.html" title="Project Reports"><span class="icon-chevron-right"></span>Project Reports</a></li>
</ul>
</nav>
<div class="well sidebar-nav">
<hr />
<div id="poweredBy">
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" /></a>
</div>
</div>
</header>
<main id="bodyColumn" class="span10" >
<h1>bnd Plugin</h1>
<p>Starting with version <code>0.3.0</code>, the JAR also provides a <a class="externalLink" href="https://bnd.bndtools.org/chapters/870-plugins.html">bnd plugin</a>. The simplest configuration (where the defaults are used) would look like:</p>
<div class="source">
<div class="source"><pre class="prettyprint linenums">&lt;plugin&gt;
&lt;groupId&gt;biz.aQute.bnd&lt;/groupId&gt;
&lt;artifactId&gt;bnd-maven-plugin&lt;/artifactId&gt;
&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.apache.sling&lt;/groupId&gt;
&lt;artifactId&gt;scriptingbundle-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;0.5.0&lt;/version&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;/plugin&gt;
</pre></div></div>
<p>and the following instructions added to your project&#x2019;s <code>bnd.bnd</code> file:</p>
<div class="source">
<div class="source"><pre class="prettyprint linenums">Require-Capability: osgi.extender;filter:=&quot;(&amp;(osgi.extender=sling.scripting)(version&gt;=1.0.0)(!(version&gt;=2.0.0)))&quot;
-plugin: org.apache.sling.scriptingbundle.plugin.bnd.BundledScriptsScannerPlugin
</pre></div></div>
<p>The bnd plugin supports the same configuration options as the <a href="metadata-mojo.html">Maven <code>metadata</code> goal</a>, using the exact same name for its configuration properties. Multiple values need to be provided as a quoted comma-separated values list (e.g. <code>sourceDirectories=&quot;src/main/scripts,src/main/resources/javax.script&quot;</code>, <code>scriptEngineMappings=&quot;html:htl,js:rhino&quot;</code>).</p>
<p>For a general usage description please refer to <a href="usage.html">Usage</a>.</p><section>
<h2><a name="Working_with_FileVault_content_package_projects"></a>Working with <a class="externalLink" href="https://jackrabbit.apache.org/filevault/index.html">FileVault</a> content package projects</h2>
<p>Starting with version 0.5.0, the bnd plugin can be used to scan <a class="externalLink" href="https://jackrabbit.apache.org/filevault/index.html">FileVault</a> content package projects. The same concepts from the <a href="usage.html">generic usage</a> instructions apply, with two differences:</p>
<ol style="list-style-type: decimal">
<li>Since content packages contain the serialisation of resource properties, the Docview <code>.content.xml</code> files will be parsed and the encountered <code>sling:resourceSuperType</code> properties will be directly used to generate the appropriate OSGi capabilities, making the <code>extends</code> file redundant (besides, the <code>extends</code> files should not be packed in a content package anyways).</li>
<li>When delegating to another resource type, you can define this relationship in your component&#x2019;s Docview <code>.content.xml</code> file, by using a new multi-value String property - <code>sling:requiredResourceTypes</code>. This property is only used by the bnd plugin to generate the correct <code>Require-Capability</code> header values. An example is available <a class="externalLink" href="https://github.com/apache/sling-org-apache-sling-scripting-bundle-tracker-it/blob/master/examples/org-apache-sling-scripting-content-package-with-bundle-attached/src/main/content/jcr_root/apps/sling/scripting/example-cp/hello/.content.xml">here</a>. When using the <code>sling:requiredResourceTypes</code> Docview property, the <code>requires</code> file is redundant.</li>
</ol>
<p>A trivial example of the bnd plugin configured to extract capabilities from a content package, together with the required plugins to also generate a <code>jar</code> file with the precompiled scripts can be seen <a class="externalLink" href="https://github.com/apache/sling-org-apache-sling-scripting-bundle-tracker-it/blob/master/examples/org-apache-sling-scripting-content-package-with-bundle-attached/pom.xml">here</a>.</p></section>
</main>
</div>
</div>
<hr/>
<footer>
<div class="container-fluid">
<div class="row-fluid">
<p>&#169; 2007&#x2013;2021
<a href="https://www.apache.org/">The Apache Software Foundation</a>
</p>
</div>
</div>
</footer>
</body>
</html>