blob: c430f3441399c0bb81f007c6c058e0ad57eb2162 [file] [log] [blame]
<!---
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head>
<meta charset="utf-8">
<title>Apache Yetus</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="../../../assets/css/bootstrap.css" rel="stylesheet">
<link href="../../../assets/css/bootstrap-theme.css" rel="stylesheet">
<link href="../../../assets/css/font-awesome.css" rel="stylesheet">
<!-- JS -->
<script type="text/javascript" src="../../../assets/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="../../../assets/js/bootstrap.js"></script>
</head>
<body>
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="img-responsive pull-left" href="/">
<img style="max-height: 40px; margin-top: 5px; margin-bottom: 5px;" src="../../../assets/img/yetus_logo.png" alt="Apache Yetus logo" />
</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="/downloads/">Downloads</a>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Documentation <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="/documentation/0.13.0/">Docs for v0.13.0</a></li>
<li><a href="/documentation/0.14.1/">Docs for v0.14.1</a></li>
<li><a href="/documentation/0.15.0/">Docs for v0.15.0</a></li>
<li><a href="/documentation/in-progress/">In Progress Docs for Contributors</a>
</li>
<li><a href="/documentation/history/">History of the Project</a>
</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Get Involved <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu" aria-labelledby="drop1">
<li role="presentation"><a role="menuitem" tabindex="-1" href="/mailinglists"><i class="fa fa-commenting"></i> Mailing Lists</a>
</li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="https://issues.apache.org/jira/browse/YETUS"><i class="fa fa-bug"></i> JIRA (Bugs)</a>
</li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="https://gitbox.apache.org/repos/asf/yetus.git"><i class="fa fa-code"></i> Source (Apache)</a>
</li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="https://github.com/apache/yetus"><i class="fa fa-github-alt"></i> Source (GitHub)</a>
</li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="/contribute/"><i class="fa fa-code-fork"></i> Contributing</a>
</li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="https://twitter.com/ApacheYetus"><i class="fa fa-twitter"></i> @ApacheYetus</a>
</li>
</ul>
</li>
<li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Apache Software Foundation <b class="caret"></b></a>
<ul class="dropdown-menu" role="menu">
<li><a href="https://www.apache.org">Apache Homepage</a>
</li>
<li><a href="https://www.apache.org/licenses/">Apache License</a>
</li>
<li><a href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a>
</li>
<li><a href="https://www.apache.org/foundation/thanks.html">Thanks</a>
</li>
<li><a href="https://www.apache.org/security/">Security</a>
</li>
</ul>
</li>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<div class="container">
<!---
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<h1 id="yetus-maven-plug-in">Yetus Maven Plug-in</h1>
<!-- MarkdownTOC levels="1,2" autolink="true" indent=" " bullets="*" bracket="round" -->
<ul>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#file-utility-goals">File Utility Goals</a>
<ul>
<li><a href="#bin4libs">bin4libs</a></li>
<li><a href="#symlink">symlink</a></li>
<li><a href="#parallel-mkdirs">parallel-mkdirs</a></li>
</ul>
</li>
</ul>
<!-- /MarkdownTOC -->
<h1 id="introduction">Introduction</h1>
<p>Apache Yetus a plug-in built for Apache Maven and compatible build tools. This plug-in offers an easy way to integrate some of Apache Yetus' functionality in addition to offering a way to get some additional functionality that is missing from the base Maven environment.</p>
<div class="highlight"><pre class="highlight plaintext"><code>NOTE: This functionality should be considered experimental. Defaults, in particular, are likely to change in future revisions.
</code></pre></div>
<h1 id="file-utility-goals">File Utility Goals</h1>
<p>As part of building Apache Yetus, we needed some portable functionality that we couldn't find elsewhere. Just so others don't have to re-invent the wheel, we offer these goals as part of the plug-in:</p>
<h2 id="bin4libs">bin4libs</h2>
<p>Apache Yetus builds wrappers in <code>bin/</code> that point to executables in <code>lib/</code>. This goal provides a way to do this generically, including providing the capability to put a license file in the wrapper.</p>
<div class="highlight"><pre class="highlight xml"><code> <span class="nt">&lt;plugin&gt;</span>
<span class="nt">&lt;groupId&gt;</span>org.apache.yetus<span class="nt">&lt;/groupId&gt;</span>
<span class="nt">&lt;artifactId&gt;</span>yetus-maven-plugin<span class="nt">&lt;/artifactId&gt;</span>
<span class="nt">&lt;executions&gt;</span>
<span class="nt">&lt;execution&gt;</span>
<span class="nt">&lt;id&gt;</span>bins4libs<span class="nt">&lt;/id&gt;</span>
<span class="nt">&lt;phase&gt;</span>prepare-package<span class="nt">&lt;/phase&gt;</span>
<span class="nt">&lt;goals&gt;</span>
<span class="nt">&lt;goal&gt;</span>bin4libs<span class="nt">&lt;/goal&gt;</span>
<span class="nt">&lt;/goals&gt;</span>
<span class="nt">&lt;configuration&gt;</span>
<span class="nt">&lt;libdir&gt;</span>lib/shelldocs<span class="nt">&lt;/libdir&gt;</span>
<span class="nt">&lt;basedir&gt;</span>${project.build.directory}/dist/<span class="nt">&lt;/basedir&gt;</span>
<span class="nt">&lt;/configuration&gt;</span>
<span class="nt">&lt;/execution&gt;</span>
<span class="nt">&lt;/executions&gt;</span>
<span class="nt">&lt;/plugin&gt;</span>
</code></pre></div>
<p>This example will take all the files located in <code>${project.build.directory}/dist/lib/shelldocs/</code> and create wrappers in <code>${project.build.directory}/dist/bin</code> with any extensions stripped off. If the <code>${project.build.directory}/dist/lib/shelldocs/</code> contains the file <code>shelldocs.py</code>, then the <code>bin/shelldocs</code> wrapper will look like this:</p>
<div class="highlight"><pre class="highlight shell"><code><span class="c">#!/usr/bin/env bash</span>
<span class="o">[</span>LICENSE TEXT]
<span class="nb">exec</span> <span class="s2">"</span><span class="si">$(</span><span class="nb">dirname</span> <span class="nt">--</span> <span class="s2">"</span><span class="k">${</span><span class="nv">BASH_SOURCE</span><span class="p">-0</span><span class="k">}</span><span class="s2">"</span><span class="si">)</span><span class="s2">/../lib/shelldocs/shelldocs.py"</span> <span class="s2">"</span><span class="nv">$@</span><span class="s2">"</span>
</code></pre></div>
<p>The wrapper as written above makes sure that nearly all forms of referencing (relative, absolute, bash -x, etc.) locates the real executable, passing along any options.</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Option</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>basedir</code></td>
<td>parent dir of <code>bindir</code> and <code>lib</code> to create relative paths</td>
<td><code>${project.build.directory}/${project.artifactId}-${project.version}</code></td>
</tr>
<tr>
<td><code>bindir</code></td>
<td>where to create wrapper</td>
<td><code>bin</code></td>
</tr>
<tr>
<td><code>encoding</code></td>
<td>encoding to use when reading license files</td>
<td><code>${project.build.sourceEncoding}</code></td>
</tr>
<tr>
<td><code>goal</code></td>
<td>the goal to use when creating the wrappers</td>
<td><code>package</code></td>
</tr>
<tr>
<td><code>lib</code></td>
<td>where the actual executable is located</td>
<td><code>lib</code></td>
</tr>
<tr>
<td><code>license</code></td>
<td>the license to put into the wrapper. See below.</td>
<td><code>ASL20</code></td>
</tr>
<tr>
<td><code>wrapper</code></td>
<td>the bash wrapper to actually use</td>
<td><code>exec "$(dirname -- "${BASH_SOURCE-0}")/../"</code></td>
</tr>
</tbody>
</table>
<h3 id="licenses">Licenses</h3>
<p>The <code>license</code> field translates to <code>licenses/NAME.txt</code> as the name of the file to load from the CLASSPATH.<br />
The <code>ASL20</code> license is the Apache Software License v2.0.</p>
<p>If no license is wanted, then set <code>license</code> to the string <code>none</code>.</p>
<h2 id="symlink">symlink</h2>
<p>Since Java 7, there has been a portable way to build symlinks. Unfortunately, standard plug-ins like the <code>maven-antrun-plugin</code> have not been updated to include the symlink task. The <code>yetus-maven-plugin</code> now exposes this functionality via the <code>symlink</code> goal:</p>
<div class="highlight"><pre class="highlight xml"><code> <span class="nt">&lt;plugin&gt;</span>
<span class="nt">&lt;groupId&gt;</span>org.apache.yetus<span class="nt">&lt;/groupId&gt;</span>
<span class="nt">&lt;artifactId&gt;</span>yetus-maven-plugin<span class="nt">&lt;/artifactId&gt;</span>
<span class="nt">&lt;executions&gt;</span>
<span class="nt">&lt;execution&gt;</span>
<span class="nt">&lt;id&gt;</span>exec-id<span class="nt">&lt;/id&gt;</span>
<span class="nt">&lt;phase&gt;</span>compile<span class="nt">&lt;/phase&gt;</span>
<span class="nt">&lt;goals&gt;</span>
<span class="nt">&lt;goal&gt;</span>symlink<span class="nt">&lt;/goal&gt;</span>
<span class="nt">&lt;/goals&gt;</span>
<span class="nt">&lt;configuration&gt;</span>
<span class="nt">&lt;basedir&gt;</span>${project.build.directory}<span class="nt">&lt;/basedir&gt;</span>
<span class="nt">&lt;target&gt;</span>existing-file-or-dir<span class="nt">&lt;/target&gt;</span>
<span class="nt">&lt;newLink&gt;</span>link-to-create<span class="nt">&lt;/newLink&gt;</span>
<span class="nt">&lt;ignoreExist&gt;</span>true<span class="nt">&lt;/ignoreExist&gt;</span>
<span class="nt">&lt;/configuration&gt;</span>
<span class="nt">&lt;/execution&gt;</span>
<span class="nt">&lt;/plugin&gt;</span>
</code></pre></div>
<p>Available configuration options:</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Option</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>basedir</code></td>
<td>where to create the symlink, if <code>newLink</code> is not absolute</td>
<td><code>${project.build.directory}</code></td>
</tr>
<tr>
<td><code>goal</code></td>
<td>the goal to use when to create the symlink</td>
<td><code>package</code></td>
</tr>
<tr>
<td><code>ignoreExist</code></td>
<td>a boolean that determines whether the goal should fail if the <code>newLink</code> already exists.</td>
<td><code>true</code>.</td>
</tr>
<tr>
<td><code>target</code></td>
<td>the file or directory to link to</td>
<td>none</td>
</tr>
<tr>
<td><code>newLink</code></td>
<td>the symlink to create</td>
<td>none</td>
</tr>
</tbody>
</table>
<h2 id="parallel-mkdirs">parallel-mkdirs</h2>
<p>Maven surefire (as of at least 2.x and earlier versions) has calculations to determine the number of tests to run in parallel. However, the result is not shared in a way that allows creating directory structures before execution. For specific build flows, this is problematic.</p>
<div class="highlight"><pre class="highlight xml"><code> <span class="nt">&lt;plugin&gt;</span>
<span class="nt">&lt;groupId&gt;</span>org.apache.yetus<span class="nt">&lt;/groupId&gt;</span>
<span class="nt">&lt;artifactId&gt;</span>yetus-maven-plugin<span class="nt">&lt;/artifactId&gt;</span>
<span class="nt">&lt;executions&gt;</span>
<span class="nt">&lt;execution&gt;</span>
<span class="nt">&lt;id&gt;</span>parallel-mkdirs<span class="nt">&lt;/id&gt;</span>
<span class="nt">&lt;phase&gt;</span>compile<span class="nt">&lt;/phase&gt;</span>
<span class="nt">&lt;goals&gt;</span>
<span class="nt">&lt;goal&gt;</span>parallel-mkdirs<span class="nt">&lt;/goal&gt;</span>
<span class="nt">&lt;/goals&gt;</span>
<span class="nt">&lt;configuration&gt;</span>
<span class="nt">&lt;buildDir&gt;</span>${project.build.directory}/test-dir<span class="nt">&lt;/buildDir&gt;</span>
<span class="nt">&lt;/configuration&gt;</span>
<span class="nt">&lt;/execution&gt;</span>
<span class="nt">&lt;/plugin&gt;</span>
</code></pre></div>
<p>Available configuration options:</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Option</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>buildDir</code></td>
<td>where to create the directories</td>
<td><code>${project.build.directory}/test-dir</code></td>
</tr>
<tr>
<td><code>forkCount</code></td>
<td>the number of directories to create</td>
<td>see blow</td>
</tr>
<tr>
<td><code>goal</code></td>
<td>the goal to use to create the directories</td>
<td><code>generate-test-resources</code></td>
</tr>
</tbody>
</table>
<p>By default, <code>forkCount</code> is inherited from surefire and therefore follows the same rules as described in its <a href="https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html">documentation</a>. Of special note is that 'C' (aka core) values are honored.</p>
</div>
<div class="container">
<hr>
<footer class="footer">
<div class="row-fluid">
<div class="span12 text-left">
<div class="span12">
Copyright 2008-2023 <a href="https://www.apache.org/">Apache Software Foundation</a>. Licensed under the <a href="https://www.apache.org/licenses/">Apache License v2.0</a>. Apache Yetus and the Apache feather logo are trademarks of The Apache Software Foundation.
</div>
</div>
</div>
</footer>
</div>
</body>
</html>