Documents rationale for using cordapp, cordaRuntime and cordaCompile Gradle configs.

This commit is contained in:
Joel Dudley 2018-01-29 12:42:31 +00:00 committed by GitHub
parent 37e207eaf3
commit 4851d9ca6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,6 +53,10 @@ The ``cordformation`` plugin adds two new gradle configurations:
* ``cordaCompile``, which extends ``compile``
* ``cordaRuntime``, which extends ``runtime``
``cordaCompile`` and ``cordaRuntime`` indicate dependencies that should not be included in the CorDapp JAR. These
configurations should be used for any Corda dependency (e.g. ``corda-core``, ``corda-node``) in order to prevent a
dependency from being included twice (once in the CorDapp JAR and once in the Corda JARs).
To build against Corda, you must add the following to your ``build.gradle`` file:
* ``net.corda:corda:$corda_release_version`` as a ``cordaRuntime`` dependency
@ -75,6 +79,15 @@ ways to add another CorDapp as a dependency in your CorDapp's ``build.gradle`` f
* ``cordapp project(":another-cordapp")`` (use this if the other CorDapp is defined in a module in the same project)
* ``cordapp "net.corda:another-cordapp:1.0"`` (use this otherwise)
The ``cordapp`` gradle configuration serves two purposes:
* When using the ``cordformation`` Gradle plugin, the ``cordapp`` configuration indicates that this JAR should be
included on your node as a CorDapp
* When using the ``cordapp`` Gradle plugin, the ``cordapp`` configuration prevents the dependency from being included
in the CorDapp JAR
Note that the ``cordformation`` and ``cordapp`` Gradle plugins can be used together.
Other dependencies
^^^^^^^^^^^^^^^^^^
If your CorDapps have any additional external dependencies, they can be specified like normal Kotlin/Java dependencies
@ -145,4 +158,4 @@ Installing the CorDapp JAR
At runtime, nodes will load any CorDapps present in their ``cordapps`` folder. Therefore in order to install a CorDapp on
a node, the CorDapp JAR must be added to the ``<node_dir>/cordapps/`` folder, where ``node_dir`` is the folder in which
the node's JAR and configuration files are stored.
the node's JAR and configuration files are stored.