Merge branch 'clint-cordamaven'

This commit is contained in:
Clinton Alexander 2016-10-05 11:44:11 +01:00
commit 38ba8c8759
7 changed files with 108 additions and 4 deletions

View File

@ -34,6 +34,7 @@ apply plugin: 'application'
apply plugin: 'project-report'
apply plugin: QuasarPlugin
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'maven-publish'
allprojects {
apply plugin: 'java'
@ -251,5 +252,16 @@ task installTemplateNodes(dependsOn: 'buildCordaJAR') << {
filter(org.apache.tools.ant.filters.FixCrLfFilter.class, eol: org.apache.tools.ant.filters.FixCrLfFilter.CrLf.newInstance("lf"))
into "${buildDir}/nodes"
}
}
publishing {
publications {
corda(MavenPublication) {
artifactId 'corda'
artifact buildCordaJAR {
classifier ""
}
}
}
}

View File

@ -1,3 +1,5 @@
apply plugin: 'maven'
repositories {
mavenCentral()
}

View File

@ -0,0 +1,20 @@
import org.gradle.api.*
import org.gradle.api.tasks.bundling.Jar
import org.gradle.api.tasks.javadoc.Javadoc
/**
* A utility plugin that when applied will automatically create source and javadoc publishing tasks
*/
class DefaultPublishTasks implements Plugin<Project> {
void apply(Project project) {
project.task("sourceJar", type: Jar, dependsOn: project.classes) {
classifier = 'sources'
from project.sourceSets.main.allSource
}
project.task("javadocJar", type: Jar, dependsOn: project.javadoc) {
classifier = 'javadoc'
from project.javadoc.destinationDir
}
}
}

View File

@ -1,5 +1,6 @@
apply plugin: 'kotlin'
apply plugin: CanonicalizerPlugin
apply plugin: DefaultPublishTasks
repositories {
mavenLocal()
@ -27,3 +28,15 @@ sourceSets {
}
}
}
publishing {
publications {
contracts(MavenPublication) {
from components.java
artifactId 'contracts'
artifact sourceJar
artifact javadocJar
}
}
}

View File

@ -2,6 +2,7 @@ apply plugin: 'kotlin'
apply plugin: QuasarPlugin
// Applying the maven plugin means this will get installed locally when running "gradle install"
apply plugin: 'maven'
apply plugin: DefaultPublishTasks
buildscript {
repositories {
@ -87,4 +88,16 @@ dependencies {
compile "org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final"
}
quasarScan.dependsOn('classes')
publishing {
publications {
core(MavenPublication) {
from components.java
artifactId 'core'
artifact sourceJar
artifact javadocJar
}
}
}
quasarScan.dependsOn('classes')

View File

@ -77,4 +77,36 @@ This command line will start the debugger on port 5005 and pause the process awa
.. _CordaPluginRegistry: api/com.r3corda.core.node/-corda-plugin-registry/index.html
.. _ServiceHubInternal: api/com.r3corda.node.services.api/-service-hub-internal/index.html
.. _ServiceHub: api/com.r3corda.node.services.api/-service-hub/index.html
.. _ServiceHub: api/com.r3corda.node.services.api/-service-hub/index.html
Building Against Corda
----------------------
.. warning:: This feature is subject to rapid change
Corda now supports publishing to Maven local to build against it. To publish to Maven local run the following in the
root directory of Corda
.. code-block:: shell
./gradlew publishToMavenLocal
This will publish corda-$version.jar, contracts-$version.jar, core-$version.jar and node-$version.jar to the
group com.r3corda. You can now depend on these as you normally would a Maven dependency.
In Gradle you can depend on these by adding/modifying your build.gradle file to contain the following:
.. code-block:: groovy
repositories {
mavenLocal()
... other repositories here ...
}
dependencies {
compile "com.r3corda:core:$corda_version"
compile "com.r3corda:contracts:$corda_version"
compile "com.r3corda:node:$corda_version"
compile "com.r3corda:corda:$corda_version"
... other dependencies here ...
}

View File

@ -1,5 +1,6 @@
apply plugin: 'kotlin'
apply plugin: QuasarPlugin
apply plugin: DefaultPublishTasks
repositories {
mavenLocal()
@ -16,7 +17,6 @@ repositories {
//noinspection GroovyAssignabilityCheck
configurations {
// we don't want isolated.jar in classPath, since we want to test jar being dynamically loaded as an attachment
runtime.exclude module: 'isolated'
@ -145,4 +145,16 @@ quasarScan.dependsOn('classes', ':core:classes', ':contracts:classes')
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
}
publishing {
publications {
node(MavenPublication) {
from components.java
artifactId 'node'
artifact sourceJar
artifact javadocJar
}
}
}