Skip to content

Commit

Permalink
GEODE-19. Support for creating Maven distribution (closes apache#1)
Browse files Browse the repository at this point in the history
Support for creating Maven distribution

- Modified groupId to 'org.apache.geode'
- Modified distribution name to 'apache-geode'
- Modified version to include 'incubating'
- Updated README.md and RUNNING.txt with new directory name
- Added 'maven-publish' plugin for creating Maven distribution

Create Maven distribution: clean build publish
Install artifacts to local Maven repo: publishToMavenLocal

Tested by using Maven artifacts in a sample application which created a cache.

Wrap Tar properties in whenReady closure

In a pull request, @metatype suggested to use a whenReady closure. The Tar properties are now wrapped in whenReady closure to prevent potential ordering issues.

Fix to only include copying spring-data-gemfire from provided configuration
  • Loading branch information
Mark Bretl authored and rvs committed May 11, 2015
1 parent 1945905 commit 748c451
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ Geode includes the following features:

# Geode in 5 minutes

Obtain the source archive from Pivotal. Extract and build from source (note: currently Geode supports jdk1.7.75):
Extract and build from source (note: currently Geode supports jdk1.7.75):

$ cd geode
$ ./gradlew build installDist

Start a locator and server:

$ cd gemfire-assembly/build/install/geode
$ cd gemfire-assembly/build/install/apache-geode
$ ./bin/gfsh
gfsh> start locator --name=locator
gfsh> start server --name=server
Expand Down
2 changes: 1 addition & 1 deletion RUNNING.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Create a distribution archive using

Unpack the archive found in gemfire-assembly/build/distributions and run the gfsh shell

cd apache-gemfire-*
cd apache-geode-*
bin/gfsh

OR
Expand Down
9 changes: 8 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ allprojects {
maven { url "http://dist.gemstone.com/maven/release" }
}

group = "io.pivotal.gemfire"
group = "org.apache.geode"

apply plugin: 'idea'
apply plugin: 'eclipse'
Expand All @@ -25,6 +25,13 @@ allprojects {
if (!buildRoot.isEmpty()) {
buildDir = buildRoot + project.path.replace(":", "/") + "/build"
}

gradle.taskGraph.whenReady( { graph ->
tasks.withType(Tar).each { tar ->
tar.compression = Compression.GZIP
tar.extension = 'tar.gz'
}
})
}

def testResultsDir(def parent, def name) {
Expand Down
92 changes: 91 additions & 1 deletion gemfire-assembly/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'org.hibernate.build.gradle', name: 'gradle-maven-publish-auth', version: '2.0.1'
}
}

apply plugin: 'distribution'
apply plugin: 'maven-publish'
apply plugin: 'maven-publish-auth'

jar.enabled = false


configurations {
archives
}
Expand Down Expand Up @@ -116,7 +128,7 @@ task gfshDepsJar (type: Jar, dependsOn: ':gemfire-core:classes') {

distributions {
main {
baseName = 'geode' //TODO rootProject.name
baseName = 'apache-geode' //TODO rootProject.name
contents {
duplicatesStrategy 'exclude'

Expand All @@ -143,6 +155,12 @@ distributions {
from project(":gemfire-joptsimple").configurations.archives.allArtifacts.files

from project(":gemfire-core").configurations.runtime
// Copying from provided configuration is only for supporting Spring Data GemFire.
// If there are more dependencies added to provided configuration, this will need
// to change
from (project(":gemfire-core").configurations.provided) {
include 'spring-data-gemfire-*'
}
from project(":gemfire-core").configurations.archives.allArtifacts.files

// include this jar
Expand All @@ -165,6 +183,78 @@ distributions {
}
}


// Repos to be added to POMs
def springReleaseRepo = [ id:'spring-release', name:'Spring Maven RELEASE Repository', url:'https://repo.spring.io/release' ]
def springMilestoneRepo = [ id:'spring-milestone', name:'Spring Maven MILESTONE Repository', url:'https://repo.spring.io/milestone' ]
def springSnapshotRepo = [ id:'spring-snapshot', name:'Spring Maven SNAPSHOT Repository', url:'https://repo.spring.io/snapshot' ]
def springLibsReleaseRepo = [ id:'libs-release', name:'Spring Maven libs-release Repository', url:'http://repo.spring.io/libs-release' ]
def springExtReleaseLocalRepo = [ id:'ext-release-local', name:'Spring Maven ext-release-local Repository', url:'http://repo.spring.io/ext-release-local' ]

def MavenRepos = [ springReleaseRepo, springSnapshotRepo, springLibsReleaseRepo, springExtReleaseLocalRepo ]

// Jars to be published via Maven
def coreJar = [publicationName:'coreJar', project:project(":gemfire-core").name]
def jgroupsJar = [publicationName:'jgroupsJar', project:project(":gemfire-jgroups").name]
def jsonJar = [publicationName:'jsonJar', project:project(":gemfire-json").name]
def joptsimpleJar = [publicationName:'joptsimpleJar', project:project(":gemfire-joptsimple").name]
def MavenJars = [ coreJar, jgroupsJar, jsonJar, joptsimpleJar ]

afterEvaluate {
publishing {
publications {
MavenJars.each {
def publicationName = it.publicationName
def projectName = it.project
"$publicationName"(MavenPublication) {
artifactId projectName
artifact project(':' + projectName).jar
pom.withXml {
def repositoriesNode = asNode().appendNode('repositories')
MavenRepos.each {
def repositoryNode = repositoriesNode.appendNode('repository')
repositoryNode.appendNode('id', it.id)
repositoryNode.appendNode('name', it.name)
repositoryNode.appendNode('url', it.url)
}
def dependenciesNode = asNode().appendNode('dependencies')
//Iterate over the runtime dependencies
project(':' + projectName).configurations.runtime.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}

// The following is typically defined in a root ASF pom: org.apache:apache
// If anything breaks around publishing check that we're still synchronized
// with whatever Maven repo definitions are there. Pay special attention to
// the names of the repositories -- they need to be spelled exactly like
// the ones defined in root ASF pom
publishing {
repositories {
if (project.version.endsWith('-SNAPSHOT')) {
// Apache Development Snapshot Repository
maven {
name "apache.snapshots.https"
url "https://repository.apache.org/content/repositories/snapshots"
}
} else {
// Apache Release Distribution Repository
maven {
name "apache.releases.https"
url "https://repository.apache.org/service/local/staging/deploy/maven2"
}
}
}
}
}

artifacts {
archives depsJar, gfshDepsJar
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 1.0.0.0-SNAPSHOT
version = 1.0.0-incubating-SNAPSHOT
org.gradle.daemon = true
org.gradle.jvmargs = -Xmx2048m

Expand Down

0 comments on commit 748c451

Please sign in to comment.