Skip to content

Commit

Permalink
Merge pull request #3001 from vespa-engine/depron0/highlight
Browse files Browse the repository at this point in the history
Depron0/highlight
  • Loading branch information
kkraune authored Nov 21, 2023
2 parents 6b24252 + ef059a4 commit d77d9b8
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 120 deletions.
168 changes: 84 additions & 84 deletions en/components/bundles.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,24 @@ <h2 id="building-an-osgi-bundle">Building an OSGi bundle</h2>
<a href="#maven-bundle-plugin">Maven bundle plugin</a>.
However, if migrating an existing Maven project, change the packaging statement to:
</p>
<pre>
&lt;packaging&gt;container-plugin&lt;/packaging&gt;
</pre>
<pre>{% highlight xml %}
<packaging>container-plugin</packaging>
{% endhighlight %}</pre>
<p>
and add the plugin to the build instructions:
</p>
<pre>
&lt;plugin&gt;
&lt;groupId&gt;com.yahoo.vespa&lt;/groupId&gt;
&lt;artifactId&gt;bundle-plugin&lt;/artifactId&gt;
&lt;!-- Find latest version at <a href="https://search.maven.org/search?q=g:com.yahoo.vespa%20a:bundle-plugin">search.maven.org/search?q=g:com.yahoo.vespa%20a:bundle-plugin</a> --&gt;
&lt;version&gt;{{site.variables.vespa_version}}&lt;/version&gt;
&lt;extensions&gt;true&lt;/extensions&gt;
&lt;configuration&gt;
&lt;failOnWarnings&gt;true&lt;/failOnWarnings&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
</pre>
<pre>{% highlight xml %}
<plugin>
<groupId>com.yahoo.vespa</groupId>
<artifactId>bundle-plugin</artifactId>
<!-- Find latest version at <a href="https://search.maven.org/search?q=g:com.yahoo.vespa%20a:bundle-plugin">search.maven.org/search?q=g:com.yahoo.vespa%20a:bundle-plugin</a> -->
<version>{{site.variables.vespa_version}}</version>
<extensions>true</extensions>
<configuration>
<failOnWarnings>true</failOnWarnings>
</configuration>
</plugin>
{% endhighlight %}</pre>
<p>
Because OSGi introduces a different runtime environment from what Maven provides when running unit tests,
one will not observe any loading and linking errors until trying to deploy the application onto a running Container.
Expand All @@ -126,7 +126,7 @@ <h2 id="building-an-osgi-bundle">Building an OSGi bundle</h2>
ensure that its dynamic loading and linking issues are covered.
</p>



<h2 id="depending-on-non-osgi-ready-libraries">Depending on non-OSGi ready libraries</h2>
<p>
Expand Down Expand Up @@ -185,17 +185,17 @@ <h3 id="add-jni-code-to-global-classpath">Add JNI code to the global classpath</
Add the following configuration in the top level <em>services</em>
element in <a href="../reference/services-container.html">services.xml</a>:
</p>
<pre>
&lt;services version="1.0"&gt;
&lt;config name="search.config.qr-start"&gt;
&lt;container&gt;
&lt;classpath_extra&gt;/lib/jars/foo.jar:/path/bar.jar&lt;/classpath_extra&gt;
&lt;export_packages&gt;com.foo,com.bar&lt;/export_packages&gt;
&lt;/container&gt;
&lt;/config&gt;
<pre>{% highlight xml %}
<services version="1.0">
<config name="search.config.qr-start">
<container>
<classpath_extra>/lib/jars/foo.jar:/path/bar.jar</classpath_extra>
<export_packages>com.foo,com.bar</export_packages>
</container>
</config>
...
&lt;/services&gt;
</pre>
</services>
{% endhighlight %}</pre>
<p>
Adding the config at the top level ensures that it's applied to all jdisc clusters.
</p>
Expand Down Expand Up @@ -301,14 +301,14 @@ <h3 id="including-third-party-libraries">Including third-party libraries</h3>
<p>
Include external dependencies into the bundle by specifying them as dependencies:
</p>
<pre>
&lt;dependency&gt;
&lt;groupId&gt;org.apache.httpcomponents.client5&lt;/groupId&gt;
&lt;artifactId&gt;httpclient5&lt;/artifactId&gt;
&lt;version&gt;5.0.3&lt;/version&gt;
&lt;scope&gt;compile&lt;/scope&gt;
&lt;/dependency&gt;
</pre>
<pre>{% highlight xml %}
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.0.3</version>
<scope>compile</scope>
</dependency>
{% endhighlight %}</pre>
<p>
All packages in the library will then be available for use.
If the external dependency is an OSGi bundle, one can deploy it
Expand Down Expand Up @@ -413,29 +413,29 @@ <h3 id="configuring-the-bundle-plugin">Configuring the Bundle-Plugin</h3>
<p>
The bundle plugin can be configured to tailor the resulting bundle to specific needs.
</p>
<pre>
&lt;build&gt;
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;com.yahoo.vespa&lt;/groupId&gt;
&lt;artifactId&gt;bundle-plugin&lt;/artifactId&gt;
&lt;version&gt;${vespa.version}&lt;/version&gt;
&lt;extensions&gt;true&lt;/extensions&gt;
&lt;configuration&gt;
&lt;failOnWarnings&gt;true/false&lt;/failOnWarnings&gt;
&lt;allowEmbeddedArtifacts&gt;&hellip;&lt;/allowEmbeddedArtifacts&gt;
&lt;attachBundleArtifact&gt;true/false&lt;/attachBundleArtifact&gt;
&lt;bundleClassifierName&gt;&hellip;&lt;/bundleClassifierName&gt;
&lt;discApplicationClass&gt;&hellip;&lt;/discApplicationClass&gt;
&lt;discPreInstallBundle&gt;&hellip;&lt;/discPreInstallBundle&gt;
&lt;bundleVersion&gt;&hellip;&lt;/bundleVersion&gt;
&lt;bundleSymbolicName&gt;&hellip;&lt;/bundleSymbolicName&gt;
&lt;bundleActivator&gt;&hellip;&lt;/bundleActivator&gt;
&lt;configGenVersion&gt;&hellip;&lt;/configGenVersion&gt;
&lt;configModels&gt;&hellip;&lt;/configModels&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
</pre>
<pre>{% highlight xml %}
<build>
<plugins>
<plugin>
<groupId>com.yahoo.vespa</groupId>
<artifactId>bundle-plugin</artifactId>
<version>${vespa.version}</version>
<extensions>true</extensions>
<configuration>
<failOnWarnings>true/false</failOnWarnings>
<allowEmbeddedArtifacts>&hellip;</allowEmbeddedArtifacts>
<attachBundleArtifact>true/false</attachBundleArtifact>
<bundleClassifierName>&hellip;</bundleClassifierName>
<discApplicationClass>&hellip;</discApplicationClass>
<discPreInstallBundle>&hellip;</discPreInstallBundle>
<bundleVersion>&hellip;</bundleVersion>
<bundleSymbolicName>&hellip;</bundleSymbolicName>
<bundleActivator>&hellip;</bundleActivator>
<configGenVersion>&hellip;</configGenVersion>
<configModels>&hellip;</configModels>
</configuration>
</plugin>
{% endhighlight %}</pre>
<table class="table">
<thead>
<tr>
Expand Down Expand Up @@ -590,9 +590,9 @@ <h3 id="could-not-load-class">Could not load class</h3>
If a component is added to services.xml, and its class cannot be found in the declared bundle,
the container will fail to start. For example:
</p>
<pre>
&lt;component id="com.example.MissingClass" bundle="my-bundle" /&gt;
</pre>
{% highlight xml %}
<component id="com.example.MissingClass" bundle="my-bundle" />
{% endhighlight %}</pre>
<p>
The log will contain an error like this:
</p>
Expand Down Expand Up @@ -832,18 +832,18 @@ <h4 id="multiple-implementations-example-slf4j-api">Multiple implementations exa
See that slf4j-api is no longer provided from container-dev, which it should.
To fix this, add an exclusion on the offender:
</p>
<pre>
&lt;dependency&gt;
&lt;groupId&gt;com.acme.utils&lt;/groupId&gt;
&lt;artifactId&gt;smartlib&lt;/artifactId&gt;
&lt;version&gt;1.0.0&lt;/version&gt;
&lt;scope&gt;compile&lt;/scope&gt;
&lt;exclusions&gt;
&lt;exclusion&gt;
&lt;groupId&gt;org.slf4j&lt;/groupId&gt;
&lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
&lt;/exclusion&gt;
</pre>
<pre>{% highlight xml %}
<dependency>
<groupId>com.acme.utils</groupId>
<artifactId>smartlib</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
{% endhighlight %}</pre>
<p>But it still does not work! And we can see why:</p>
<pre>
$ jar -tf mailsearch-docprocs-deploy.jar | grep slf
Expand Down Expand Up @@ -871,15 +871,15 @@ <h4 id="multiple-implementations-example-slf4j-api">Multiple implementations exa
dependencies/slf4j-api-1.7.5.jar
</pre>
<p>One can make it work by managing this dependency explicitly - add this at POM top-level:</p>
<pre>
&lt;dependencyManagement&gt;
&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.slf4j&lt;/groupId&gt;
&lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
&lt;version&gt;1.7.5&lt;/version&gt;
&lt;scope&gt;provided&lt;/scope&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;/dependencyManagement&gt;
</pre>
<pre>{% highlight xml %}
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
{% endhighlight %}</pre>
72 changes: 36 additions & 36 deletions en/components/chained-components.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,25 +130,25 @@ <h2 id="chain-inheritance">Chain Inheritance</h2>
As implied by examples above, chains may inherit other chains
in <em>services.xml</em>.
</p>
<pre>
&lt;container version="1.0"&gt;
&lt;processing&gt;
&lt;chain id="foo"&gt;
&lt;processor id="ai.vespa.examples.ConnexityProcessor"/&gt;
&lt;processor id="ai.vespa.examples.IteratingProcessor"/&gt;
&lt;processor id="ai.vespa.examples.SignificanceProcessor" /&gt;
&lt;/chain&gt;
&lt;chain id="bar"
<pre>{% highlight xml %}
<container version="1.0">
<processing>
<chain id="foo">
<processor id="ai.vespa.examples.ConnexityProcessor"/>
<processor id="ai.vespa.examples.IteratingProcessor"/>
<processor id="ai.vespa.examples.SignificanceProcessor" />
</chain>
<chain id="bar"
inherits="foo"
excludes="ai.vespa.examples.IteratingProcessor"&gt;
&lt;processor id="ai.vespa.examples.ReverseProcessor" /&gt;
&lt;/chain&gt;
&lt;/processing&gt;
&lt;nodes&gt;
&lt;node hostalias="node1" /&gt;
&lt;/nodes&gt;
&lt;/container&gt;
</pre>
excludes="ai.vespa.examples.IteratingProcessor">
<processor id="ai.vespa.examples.ReverseProcessor" />
</chain>
</processing>
<nodes>
<node hostalias="node1" />
</nodes>
</container>
{% endhighlight %}</pre>
<p>
A chain will include all components from the chains named in the
optional <code>inherits</code> attribute, exclude from that set all
Expand All @@ -166,25 +166,25 @@ <h2 id="chain-inheritance">Chain Inheritance</h2>
few extra searchers which most installations containing Vespa backends will need.
</p>
<!-- ToDo: Add example queries/config so users can find out -->
<pre>
&lt;container version="1.0"&gt;
&lt;search&gt;
&lt;chain id="default"
<pre>{% highlight xml %}
<container version="1.0">
<search>
<chain id="default"
inherits="vespa"
excludes="com.yahoo.prelude.querytransform.StemmingSearcher com.yahoo.prelude.querytransform.NormalizingSearcher"&gt;
&lt;searcher id="ai.vespa.examples.ConnexitySearcher"
bundle="the name in artifactId in pom.xml" /&gt;
&lt;searcher id="ai.vespa.examples.SignificanceSearcher"
bundle="the name in artifactId in pom.xml" /&gt;
&lt;searcher id="ai.vespa.examples.ReverseSearcher"
bundle="the name in artifactId in pom.xml" /&gt;
&lt;/chain&gt;
&lt;/search&gt;
&lt;nodes&gt;
&lt;node hostalias="node1" /&gt;
&lt;/nodes&gt;
&lt;/container&gt;
</pre>
excludes="com.yahoo.prelude.querytransform.StemmingSearcher com.yahoo.prelude.querytransform.NormalizingSearcher">
<searcher id="ai.vespa.examples.ConnexitySearcher"
bundle="the name in artifactId in pom.xml" />
<searcher id="ai.vespa.examples.SignificanceSearcher"
bundle="the name in artifactId in pom.xml" />
<searcher id="ai.vespa.examples.ReverseSearcher"
bundle="the name in artifactId in pom.xml" />
</chain>
</search>
<nodes>
<node hostalias="node1" />
</nodes>
</container>
{% endhighlight %}</pre>



Expand Down

0 comments on commit d77d9b8

Please sign in to comment.