corda/docs/build/html/CLI-vs-IDE.html
2016-11-29 20:49:25 +00:00

352 lines
18 KiB
HTML

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CLI vs IDE &mdash; R3 Corda latest documentation</title>
<link rel="stylesheet" href="_static/css/custom.css" type="text/css" />
<link rel="top" title="R3 Corda latest documentation" href="index.html"/>
<link rel="next" title="Data model" href="data-model.html"/>
<link rel="prev" title="Running the demos" href="running-the-demos.html"/>
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> R3 Corda
</a>
<div class="version">
latest
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<br>
<a href="api/index.html">API reference</a>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Getting started</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="inthebox.html">What&#8217;s included?</a></li>
<li class="toctree-l1"><a class="reference internal" href="getting-set-up.html">Getting set up</a></li>
<li class="toctree-l1"><a class="reference internal" href="getting-set-up-fault-finding.html">Getting set up: troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="running-the-demos.html">Running the demos</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">CLI vs IDE</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#ide-intellij">IDE - IntelliJ</a></li>
<li class="toctree-l2"><a class="reference internal" href="#command-line">Command Line</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#windows-vs-mac-unix">Windows vs Mac / Unix</a></li>
<li class="toctree-l3"><a class="reference internal" href="#frequently-used-gradle-tasks">Frequently Used Gradle Tasks</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#debugging">Debugging</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#via-the-ide">Via the IDE</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<p class="caption"><span class="caption-text">Key concepts</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="data-model.html">Data model</a></li>
<li class="toctree-l1"><a class="reference internal" href="transaction-data-types.html">Data types</a></li>
<li class="toctree-l1"><a class="reference internal" href="merkle-trees.html">Transaction tear-offs</a></li>
<li class="toctree-l1"><a class="reference internal" href="consensus.html">Consensus model</a></li>
<li class="toctree-l1"><a class="reference internal" href="clauses.html">Clauses key concepts</a></li>
</ul>
<p class="caption"><span class="caption-text">CorDapps</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="creating-a-cordapp.html">CorDapps Background</a></li>
<li class="toctree-l1"><a class="reference internal" href="creating-a-cordapp.html#gradle-plugins-for-cordapps">Gradle plugins for CorDapps</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-cordapp.html">The CorDapp Template</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-cordapp.html#building-the-cordapp-template">Building the CorDapp template</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-cordapp.html#running-the-sample-cordapp">Running the Sample CorDapp</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-cordapp.html#using-the-sample-cordapp">Using the sample CorDapp</a></li>
</ul>
<p class="caption"><span class="caption-text">The Corda node</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="clientrpc.html">Client RPC</a></li>
<li class="toctree-l1"><a class="reference internal" href="messaging.html">Networking and messaging</a></li>
<li class="toctree-l1"><a class="reference internal" href="persistence.html">Persistence</a></li>
<li class="toctree-l1"><a class="reference internal" href="node-administration.html">Node administration</a></li>
<li class="toctree-l1"><a class="reference internal" href="corda-configuration-file.html">Node configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="corda-plugins.html">The Corda plugin framework</a></li>
<li class="toctree-l1"><a class="reference internal" href="node-services.html">Brief introduction to the node services</a></li>
<li class="toctree-l1"><a class="reference internal" href="node-explorer.html">Node Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="permissioning.html">Network permissioning</a></li>
</ul>
<p class="caption"><span class="caption-text">Tutorials</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="tutorial-contract.html">Writing a contract</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-contract-clauses.html">Writing a contract using clauses</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-test-dsl.html">Writing a contract test</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-integration-testing.html">Integration Test Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-clientrpc-api.html">Client RPC API tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-building-transactions.html">Building Transactions</a></li>
<li class="toctree-l1"><a class="reference internal" href="flow-state-machines.html">Writing flows</a></li>
<li class="toctree-l1"><a class="reference internal" href="flow-testing.html">Writing flow tests</a></li>
<li class="toctree-l1"><a class="reference internal" href="running-a-notary.html">Running a notary service</a></li>
<li class="toctree-l1"><a class="reference internal" href="using-a-notary.html">Using a notary service</a></li>
<li class="toctree-l1"><a class="reference internal" href="oracles.html">Writing oracle services</a></li>
<li class="toctree-l1"><a class="reference internal" href="oracles.html#implementing-an-oracle-with-continuously-varying-data">Implementing an oracle with continuously varying data</a></li>
<li class="toctree-l1"><a class="reference internal" href="oracles.html#using-an-oracle">Using an oracle</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-attachments.html">Using attachments</a></li>
<li class="toctree-l1"><a class="reference internal" href="event-scheduling.html">Event scheduling</a></li>
</ul>
<p class="caption"><span class="caption-text">Other</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="network-simulator.html">Network Simulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="initial-margin-agreement.html">Initial margin agreements</a></li>
</ul>
<p class="caption"><span class="caption-text">Component library</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="contract-catalogue.html">Contract catalogue</a></li>
<li class="toctree-l1"><a class="reference internal" href="contract-irs.html">Interest rate swaps</a></li>
</ul>
<p class="caption"><span class="caption-text">Appendix</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="loadtesting.html">Load testing</a></li>
<li class="toctree-l1"><a class="reference internal" href="setting-up-a-corda-network.html">Introduction - What is a corda network?</a></li>
<li class="toctree-l1"><a class="reference internal" href="setting-up-a-corda-network.html#setting-up-your-own-network">Setting up your own network</a></li>
<li class="toctree-l1"><a class="reference internal" href="secure-coding-guidelines.html">Secure coding guidelines</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-process.html">Release process</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-process.html#steps-to-cut-a-release">Steps to cut a release</a></li>
<li class="toctree-l1"><a class="reference internal" href="release-notes.html">Release notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="codestyle.html">Code style guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="building-the-docs.html">Building the documentation</a></li>
</ul>
<p class="caption"><span class="caption-text">Glossary</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="glossary.html">Glossary</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">R3 Corda</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li>CLI vs IDE</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/CLI-vs-IDE.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="cli-vs-ide">
<h1>CLI vs IDE<a class="headerlink" href="#cli-vs-ide" title="Permalink to this headline"></a></h1>
<p>We have tried to make every demo, example, tutorial and sample to be both usuable via the command line and also the IntelliJ IDE.
Most developers will find writing, editing and debugging code more easily done via tools such as an IDE, but when code needs
to be deployed to run as nodes, control must be done via the command line - no organisations allow their systems to be running via
a developer environment.</p>
<div class="section" id="ide-intellij">
<h2>IDE - IntelliJ<a class="headerlink" href="#ide-intellij" title="Permalink to this headline"></a></h2>
<p>IntelliJ (the preferred IDE in R3) integrates well with gradle (our chosed build, deploy and CLI tool). IntelliJ understands gradle
tasks and dependencies, automatically loading them in the background when a project is first loaded or the gradle
project changes. Occasionally, however, you may need to refresh the gradle project manually - but this is hinted to you
by the IDE. It&#8217;s a good idea to do this before carrying on with other work (and in fact you may find it is essential to pick
up new libraries etc).</p>
<p>There are some great resources about how to get started using IntelliJ. As opposed to trying to repeat them here, we advise
you to go to the <a class="reference external" href="https://www.jetbrains.com/idea/documentation/">IntelliJ docs here</a>.</p>
</div>
<div class="section" id="command-line">
<h2>Command Line<a class="headerlink" href="#command-line" title="Permalink to this headline"></a></h2>
<div class="section" id="windows-vs-mac-unix">
<h3>Windows vs Mac / Unix<a class="headerlink" href="#windows-vs-mac-unix" title="Permalink to this headline"></a></h3>
<p>Due to the nature of their respective command interfaces, gradle is typically ran in windows with the command <code class="docutils literal"><span class="pre">gradle.bat</span></code>
(or <code class="docutils literal"><span class="pre">gradlew.bat</span></code> if using the wrapper) and in Mac / Unix environments it is ran via <code class="docutils literal"><span class="pre">./gradlew</span></code>. For brevity, the
simple windows syntax <code class="docutils literal"><span class="pre">gradle</span></code> is used for the majority of the documentation.</p>
<p>As well as including the most significant run and build configurations in the IDE, we also provide gradle tasks to build, install
and run significant parts of Corda demos and tools. Gradle is highly extensible and we use it for downloading required resources,
building components, installing those built components into shared areas, configuring the scripts that run nodes, starting
up demonstration API calls amongst other things. It is exceptionally good at deriving dependency maps and therefore performing
the preceeding tasks required in order to do the requested task. However, when confusing build errors manifest, then sometimes
a <code class="docutils literal"><span class="pre">gradle</span> <span class="pre">clean</span></code> may be required in order to clear out any build areas that have an inconsistent state. The total build time
from downloading / cloaning the repo to a complete build should be only a few minutes, obviously slightly longer if the
unit tests are run.</p>
</div>
<div class="section" id="frequently-used-gradle-tasks">
<h3>Frequently Used Gradle Tasks<a class="headerlink" href="#frequently-used-gradle-tasks" title="Permalink to this headline"></a></h3>
<p>Note that the list of tasks can be ran for any gradle project can be displayed by running the task <code class="docutils literal"><span class="pre">tasks</span></code>. Also note that
gradle is hierachical and therefore tasks in child directories can be run using a colon seperator - ie if you want to run
the sample attachment-demo <code class="docutils literal"><span class="pre">runSender</span></code> you would use the command <code class="docutils literal"><span class="pre">gradle</span> <span class="pre">samples:attachment-demo:runSender</span></code></p>
<p>The most frequent gradle tasks you will probably be running are <code class="docutils literal"><span class="pre">build</span></code> and <code class="docutils literal"><span class="pre">install</span></code>. The <code class="docutils literal"><span class="pre">build</span></code> command also executes the
unit tests as well. If you want to build without this level of verification, then use the <code class="docutils literal"><span class="pre">assemble</span></code> command - but we do
not recommend this. After running build, the <code class="docutils literal"><span class="pre">install</span></code> tasks copies over the built jars into the local maven repository
which will then makes these available for either the sample code or use with the CorDapp template.</p>
</div>
</div>
<div class="section" id="debugging">
<h2>Debugging<a class="headerlink" href="#debugging" title="Permalink to this headline"></a></h2>
<p>Tasks and processes that are run directly via the IDE (including via the usage of the <code class="docutils literal"><span class="pre">driver</span></code> DSL) can be remotely debugged.
We do not have java debugging currently enabled in the <code class="docutils literal"><span class="pre">runnodes</span></code> scripts generated by a process we refer to as &#8216;cordformation&#8217;
but we will be implementing that shortly.</p>
<div class="section" id="via-the-ide">
<h3>Via the IDE<a class="headerlink" href="#via-the-ide" title="Permalink to this headline"></a></h3>
<p>To debug: From the IDE, configure the debug connectivity option by the &#8220;Edit Configurations&#8221; and choosing &#8220;+&#8221; and then &#8220;Remote&#8221;.
The debug port start at 5005 and increments for each additional node that starts, the order given by the list in the main
driver configuration (which is primarily listed in the <code class="docutils literal"><span class="pre">main</span></code> function of <code class="docutils literal"><span class="pre">Main.kt</span></code> for each sample. Look for the string
<code class="docutils literal"><span class="pre">Listening</span> <span class="pre">for</span> <span class="pre">transport</span> <span class="pre">dt_socket</span> <span class="pre">at</span> <span class="pre">address:5xxx</span></code> in the log output to determine the exact port for that node. If the log
messages are mixed from several nodes to the same console, then (as earlier stated), the port numbers increment in the order
they are listed in the driver DSL configuration.</p>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="data-model.html" class="btn btn-neutral float-right" title="Data model" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="running-the-demos.html" class="btn btn-neutral" title="Running the demos" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2016, R3 Limited.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'latest',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>