diff --git a/build.gradle b/build.gradle index 1c4363bf1..dcadbe72c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,155 +1,35 @@ -ext.githubProjectName = 'eureka' - -ext { - jerseyVersion="1.11" - governatorVersion="1.2.10" - archaiusVersion="0.6.0" - ribbonVersion="2.0-RC9" - blitzVersion="1.34" +plugins { + id 'nebula.netflixoss' version '2.2.3' } -buildscript { - repositories { - mavenLocal() - mavenCentral() // maven { url 'http://jcenter.bintray.com' } - } - apply from: file('gradle/buildscript.gradle'), to: buildscript -} - -allprojects { - repositories { - mavenCentral() // maven { url: 'http://jcenter.bintray.com' } - } +ext { + githubProjectName = 'eureka' + jerseyVersion='1.11' + governatorVersion='1.2.10' + archaiusVersion='0.6.0' + ribbonVersion='2.0-RC9' + blitzVersion='1.34' } -apply from: file('gradle/convention.gradle') -apply from: file('gradle/maven.gradle') -apply from: file('gradle/check.gradle') -apply from: file('gradle/license.gradle') -apply from: file('gradle/release.gradle') - subprojects { - group = "com.netflix.${githubProjectName}" - - test { - forkEvery = 1 - // setting this property prevents java from grabbing focus when running the tests under osx - systemProperty 'java.awt.headless', 'true' - } - - jar { - manifest { - attributes("Implementation-Title": name, "Implementation-Version": version,'Build-Time-ISO-8601': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")) - } - } -} - -if (JavaVersion.current().isJava8Compatible()) { - allprojects { - tasks.withType(Javadoc) { - options.addStringOption('Xdoclint:none', '-quiet') - } - } -} + apply plugin: 'nebula.netflixoss' + apply plugin: 'java' -project(':eureka-client') { - dependencies { - compile "com.netflix.netflix-commons:netflix-eventbus:0.1.2" - compile 'com.thoughtworks.xstream:xstream:1.4.2' - compile "com.netflix.archaius:archaius-core:$archaiusVersion" - compile 'javax.ws.rs:jsr311-api:1.1.1' - compile 'com.netflix.servo:servo-core:0.7.4' - compile "com.sun.jersey:jersey-core:$jerseyVersion" - compile "com.sun.jersey:jersey-client:$jerseyVersion" - compile 'com.sun.jersey.contribs:jersey-apache-client4:1.11' - compile 'org.apache.httpcomponents:httpclient:4.2.1' - compile "com.netflix.ribbon:ribbon-httpclient:$ribbonVersion" - compile "com.netflix.governator:governator:$governatorVersion" - runtime 'org.codehaus.jettison:jettison:1.2' - - testCompile 'junit:junit:4.10' - testCompile 'org.mortbay.jetty:jetty:6.1H.22' - } - - task testJar(type: Jar) { - classifier = 'tests' - from sourceSets.test.output - } - - configurations { - tests - published.extendsFrom tests, archives - } - - artifacts { - tests testJar - } + group = "com.netflix.${githubProjectName}" - install { - configuration = configurations.published + repositories { + jcenter() } -} - -project(':eureka-core') { test { forkEvery = 1 // setting this property prevents java from grabbing focus when running the tests under osx systemProperty 'java.awt.headless', 'true' } - dependencies { - compile project(':eureka-client') - - compile 'com.amazonaws:aws-java-sdk:1.3.27' - compile 'javax.servlet:servlet-api:2.4' - compile 'com.thoughtworks.xstream:xstream:1.4.2' - compile 'javax.ws.rs:jsr311-api:1.1.1' - compile "com.netflix.blitz4j:blitz4j:$blitzVersion" - - testCompile 'junit:junit:4.10' - testCompile 'org.mortbay.jetty:jetty:6.1H.22' - testCompile 'org.mockito:mockito-all:1.8.5' - testRuntime 'org.slf4j:slf4j-simple:1.7.0' - testCompile project(':eureka-client') - } -} - -project(':eureka-resources') { -} - -project(':eureka-server') { - apply plugin: 'war' - - sourceSets.main.java.srcDir 'test/java' - - war { - from('conf') { - include 'eureka-server*' - include 'eureka-client*' - include 'log4j.properties' - into 'WEB-INF/classes/' + jar { + manifest { + attributes('Build-Time-ISO-8601': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")) } - from (project(':eureka-resources').file('build/resources/main')) - webXml = file('WEB-INF/web.xml') // copies a file to WEB-INF/web.xml - } - - dependencies { - compile project(':eureka-client') - compile project(':eureka-core') - runtime 'xerces:xercesImpl:2.4.0' - runtime 'asm:asm:3.1' - compile "com.sun.jersey:jersey-server:$jerseyVersion" - compile "com.sun.jersey:jersey-servlet:$jerseyVersion" - compile 'org.slf4j:slf4j-log4j12:1.6.1' - runtime 'org.codehaus.jettison:jettison:1.2' - providedCompile 'javax.servlet:servlet-api:2.4' - } - - delete 'testlibs' - copy { - from zipTree('build/libs/'+ war.archiveName) - into 'testlibs' - include 'WEB-INF/lib/' } } diff --git a/codequality/HEADER b/codequality/HEADER deleted file mode 100644 index 3102e4b44..000000000 --- a/codequality/HEADER +++ /dev/null @@ -1,13 +0,0 @@ -Copyright ${year} Netflix, Inc. - -Licensed 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. diff --git a/eureka-client/build.gradle b/eureka-client/build.gradle new file mode 100644 index 000000000..349bcd4b9 --- /dev/null +++ b/eureka-client/build.gradle @@ -0,0 +1,19 @@ +apply plugin: 'nebula-test-jar' + +dependencies { + compile "com.netflix.netflix-commons:netflix-eventbus:0.1.2" + compile 'com.thoughtworks.xstream:xstream:1.4.2' + compile "com.netflix.archaius:archaius-core:$archaiusVersion" + compile 'javax.ws.rs:jsr311-api:1.1.1' + compile 'com.netflix.servo:servo-core:0.7.4' + compile "com.sun.jersey:jersey-core:$jerseyVersion" + compile "com.sun.jersey:jersey-client:$jerseyVersion" + compile 'com.sun.jersey.contribs:jersey-apache-client4:1.11' + compile 'org.apache.httpcomponents:httpclient:4.2.1' + compile "com.netflix.ribbon:ribbon-httpclient:$ribbonVersion" + compile "com.netflix.governator:governator:$governatorVersion" + runtime 'org.codehaus.jettison:jettison:1.2' + + testCompile 'junit:junit:4.10' + testCompile 'org.mortbay.jetty:jetty:6.1H.22' +} diff --git a/eureka-core/build.gradle b/eureka-core/build.gradle new file mode 100644 index 000000000..dc4b78a71 --- /dev/null +++ b/eureka-core/build.gradle @@ -0,0 +1,15 @@ +dependencies { + compile project(':eureka-client') + + compile 'com.amazonaws:aws-java-sdk:1.3.27' + compile 'javax.servlet:servlet-api:2.4' + compile 'com.thoughtworks.xstream:xstream:1.4.2' + compile 'javax.ws.rs:jsr311-api:1.1.1' + compile "com.netflix.blitz4j:blitz4j:$blitzVersion" + + testCompile 'junit:junit:4.10' + testCompile 'org.mortbay.jetty:jetty:6.1H.22' + testCompile 'org.mockito:mockito-all:1.8.5' + testRuntime 'org.slf4j:slf4j-simple:1.7.0' + testCompile project(':eureka-client') +} diff --git a/eureka-server/build.gradle b/eureka-server/build.gradle new file mode 100644 index 000000000..678d4e3ae --- /dev/null +++ b/eureka-server/build.gradle @@ -0,0 +1,22 @@ +apply plugin: 'war' + +dependencies { + compile project(':eureka-client') + compile project(':eureka-core') + runtime 'xerces:xercesImpl:2.4.0' + runtime 'asm:asm:3.1' + compile "com.sun.jersey:jersey-server:$jerseyVersion" + compile "com.sun.jersey:jersey-servlet:$jerseyVersion" + compile 'org.slf4j:slf4j-log4j12:1.6.1' + runtime 'org.codehaus.jettison:jettison:1.2' + providedCompile 'javax.servlet:servlet-api:2.4' +} + +task copyLibs(type: Copy) { + into 'testlibs/WEB-INF/libs' + from configurations.runtime +} + +war { + from (project(':eureka-resources').file('build/resources/main')) +} diff --git a/gradle/buildscript.gradle b/gradle/buildscript.gradle deleted file mode 100644 index 0b6da7ce8..000000000 --- a/gradle/buildscript.gradle +++ /dev/null @@ -1,11 +0,0 @@ -// Executed in context of buildscript -repositories { - // Repo in addition to maven central - repositories { maven { url 'http://dl.bintray.com/content/netflixoss/external-gradle-plugins/' } } // For gradle-release -} -dependencies { - classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.6.1' - classpath 'com.mapvine:gradle-cobertura-plugin:0.1' - classpath 'gradle-release:gradle-release:1.1.5' - classpath 'org.ajoberstar:gradle-git:0.5.0' -} diff --git a/gradle/check.gradle b/gradle/check.gradle deleted file mode 100644 index 98888d4b0..000000000 --- a/gradle/check.gradle +++ /dev/null @@ -1,26 +0,0 @@ -subprojects { -// Checkstyle -apply plugin: 'checkstyle' -checkstyle { - ignoreFailures = true - configFile = rootProject.file('codequality/checkstyle.xml') -} - -// FindBugs -//apply plugin: 'findbugs' -//findbugs { -// ignoreFailures = true -//} - -// PMD -//apply plugin: 'pmd' -//tasks.withType(Pmd) { reports.html.enabled true } - -apply plugin: 'cobertura' -cobertura { - sourceDirs = sourceSets.main.java.srcDirs - format = 'html' - includes = ['**/*.java', '**/*.groovy'] - excludes = [] -} -} diff --git a/gradle/convention.gradle b/gradle/convention.gradle deleted file mode 100644 index bf9d57bdb..000000000 --- a/gradle/convention.gradle +++ /dev/null @@ -1,101 +0,0 @@ -// GRADLE-2087 workaround, perform after java plugin -status = project.hasProperty('preferredStatus')?project.preferredStatus:(version.contains('SNAPSHOT')?'snapshot':'release') - -subprojects { project -> - apply plugin: 'java' // Plugin as major conventions - - sourceCompatibility = 1.6 - - // Restore status after Java plugin - status = rootProject.status - - task sourcesJar(type: Jar, dependsOn:classes) { - from sourceSets.main.allSource - classifier 'sources' - extension 'jar' - } - - task javadocJar(type: Jar, dependsOn:javadoc) { - from javadoc.destinationDir - classifier 'javadoc' - extension 'jar' - } - - configurations.add('sources') - configurations.add('javadoc') - configurations.archives { - extendsFrom configurations.sources - extendsFrom configurations.javadoc - } - - // When outputing to an Ivy repo, we want to use the proper type field - gradle.taskGraph.whenReady { - def isNotMaven = !it.hasTask(project.uploadMavenCentral) - if (isNotMaven) { - def artifacts = project.configurations.sources.artifacts - def sourceArtifact = artifacts.iterator().next() - sourceArtifact.type = 'sources' - } - } - - artifacts { - sources(sourcesJar) { - // Weird Gradle quirk where type will be used for the extension, but only for sources - type 'jar' - } - javadoc(javadocJar) { - type 'javadoc' - } - } - - configurations { - provided { - description = 'much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive.' - transitive = true - visible = true - } - } - - project.sourceSets { - main.compileClasspath += project.configurations.provided - main.runtimeClasspath -= project.configurations.provided - test.compileClasspath += project.configurations.provided - test.runtimeClasspath += project.configurations.provided - } -} - -apply plugin: 'github-pages' // Used to create publishGhPages task - -def docTasks = [:] -[Javadoc,ScalaDoc,Groovydoc].each{ Class docClass -> - def allSources = allprojects.tasks*.withType(docClass).flatten()*.source - if (allSources) { - def shortName = docClass.simpleName.toLowerCase() - def docTask = task "aggregate${shortName.capitalize()}"(type: docClass, description: "Aggregate subproject ${shortName}s") { - source = allSources - destinationDir = file("${project.buildDir}/docs/${shortName}") - doFirst { - def classpaths = allprojects.findAll { it.plugins.hasPlugin(JavaPlugin) }.collect { it.sourceSets.main.compileClasspath } - classpath = files(classpaths) - } - } - docTasks[shortName] = docTask - processGhPages.dependsOn(docTask) - } -} - -githubPages { - repoUri = "git@github.com:Netflix/${rootProject.githubProjectName}.git" - pages { - docTasks.each { shortName, docTask -> - from(docTask.outputs.files) { - into "docs/${shortName}" - } - } - } -} - -// Generate wrapper, which is distributed as part of source to alleviate the need of installing gradle -task createWrapper(type: Wrapper) { - gradleVersion = '1.5' -} diff --git a/gradle/license.gradle b/gradle/license.gradle deleted file mode 100644 index abd2e2c0e..000000000 --- a/gradle/license.gradle +++ /dev/null @@ -1,10 +0,0 @@ -// Dependency for plugin was set in buildscript.gradle - -subprojects { -apply plugin: 'license' //nl.javadude.gradle.plugins.license.LicensePlugin -license { - header rootProject.file('codequality/HEADER') - ext.year = Calendar.getInstance().get(Calendar.YEAR) - skipExistingHeaders true -} -} diff --git a/gradle/maven.gradle b/gradle/maven.gradle deleted file mode 100644 index 817846d77..000000000 --- a/gradle/maven.gradle +++ /dev/null @@ -1,70 +0,0 @@ -// Maven side of things -subprojects { - apply plugin: 'maven' // Java plugin has to have been already applied for the conf2scope mappings to work - apply plugin: 'signing' - - signing { - required { gradle.taskGraph.hasTask(uploadMavenCentral) } - sign configurations.archives - } - -/** - * Publishing to Maven Central example provided from http://jedicoder.blogspot.com/2011/11/automated-gradle-project-deployment-to.html - * artifactory will execute uploadArchives to force generation of ivy.xml, and we don't want that to trigger an upload to maven - * central, so using custom upload task. - */ -task uploadMavenCentral(type:Upload, dependsOn: signArchives) { - configuration = configurations.archives - onlyIf { ['release', 'snapshot'].contains(project.status) } - repositories.mavenDeployer { - beforeDeployment { signing.signPom(it) } - - // To test deployment locally, use the following instead of oss.sonatype.org - //repository(url: "file://localhost/${rootProject.rootDir}/repo") - - def sonatypeUsername = rootProject.hasProperty('sonatypeUsername')?rootProject.sonatypeUsername:'' - def sonatypePassword = rootProject.hasProperty('sonatypePassword')?rootProject.sonatypePassword:'' - - repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') { - authentication(userName: sonatypeUsername, password: sonatypePassword) - } - - snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') { - authentication(userName: sonatypeUsername, password: sonatypePassword) - } - - // Prevent datastamp from being appending to artifacts during deployment - uniqueVersion = false - - // Closure to configure all the POM with extra info, common to all projects - pom.project { - name "${project.name}" - description "${project.name} developed by Netflix" - developers { - developer { - id 'netflixgithub' - name 'Netflix Open Source Development' - email 'talent@netflix.com' - } - } - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution 'repo' - } - } - url "https://github.com/Netflix/${rootProject.githubProjectName}" - scm { - connection "scm:git:git@github.com:Netflix/${rootProject.githubProjectName}.git" - url "scm:git:git@github.com:Netflix/${rootProject.githubProjectName}.git" - developerConnection "scm:git:git@github.com:Netflix/${rootProject.githubProjectName}.git" - } - issueManagement { - system 'github' - url "https://github.com/Netflix/${rootProject.githubProjectName}/issues" - } - } - } - } -} diff --git a/gradle/netflix-oss.gradle b/gradle/netflix-oss.gradle deleted file mode 100644 index 20ae363c5..000000000 --- a/gradle/netflix-oss.gradle +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2014 Netflix, Inc. - * - * Licensed 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. - */ -apply from: 'http://artifacts.netflix.com/gradle-netflix-local/artifactory.gradle' - -def artifactsBase = 'http://artifacts.netflix.com/' -def ivyIvyPattern = '[organisation]/[module]/[revision]/[module]-[revision]-ivy.[ext]' -def ivyArtifactPattern = '[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]' - -allprojects { - dependencies.components.eachComponent { ComponentMetadataDetails details -> - details.statusScheme = ['snapshot', 'integration', 'candidate', 'release'] - } - repositories.matching { it.name.contains('nfrepo-') && it.class.name.contains('legacy') }.all { - println "Replacing URLResolver ${it.name}" - repositories.remove(it) - repositories.ivy { - name = "nfrepo-${project.status}s" - def artifactsUrl = artifactsBase + name - credentials { - username 'resolver' - password 'resolver' - } - url "${artifactsBase}/${name}" - layout 'pattern', { - artifact ivyArtifactPattern - ivy ivyIvyPattern - m2compatible = true - } - } - repositories.maven { - name = "nfrepo-${project.status}s-pom" - url "${artifactsBase}/${name}" - } - } -} diff --git a/gradle/release.gradle b/gradle/release.gradle deleted file mode 100644 index 7979dc3a1..000000000 --- a/gradle/release.gradle +++ /dev/null @@ -1,61 +0,0 @@ -apply plugin: 'release' - -[ uploadIvyLocal: 'uploadLocal', uploadArtifactory: 'artifactoryPublish', buildWithArtifactory: 'build' ].each { key, value -> - // Call out to compile against internal repository - task "${key}"(type: GradleBuild) { - startParameter = project.gradle.startParameter.newInstance() - doFirst { - startParameter.projectProperties = [status: project.status, preferredStatus: project.status] - } - startParameter.addInitScript( file('gradle/netflix-oss.gradle') ) - startParameter.getExcludedTaskNames().add('check') - tasks = [ 'build', value ] - } -} - -// Marker task for following code to key in on -task releaseCandidate(dependsOn: release) -task forceCandidate { - onlyIf { gradle.taskGraph.hasTask(releaseCandidate) } - doFirst { project.status = 'candidate' } -} -task forceRelease { - onlyIf { !gradle.taskGraph.hasTask(releaseCandidate) } - doFirst { project.status = 'release' } -} -release.dependsOn([forceCandidate, forceRelease]) - -task uploadMavenCentral(dependsOn: subprojects.tasks.uploadMavenCentral) -task releaseSnapshot(dependsOn: [uploadArtifactory, uploadMavenCentral]) - -// Ensure our versions look like the project status before publishing -task verifyStatus << { - def hasSnapshot = version.contains('-SNAPSHOT') - if (project.status == 'snapshot' && !hasSnapshot) { - throw new GradleException("Version (${version}) needs -SNAPSHOT if publishing snapshot") - } -} -uploadArtifactory.dependsOn(verifyStatus) -uploadMavenCentral.dependsOn(verifyStatus) - -// Ensure upload happens before taggging, hence upload failures will leave repo in a revertable state -preTagCommit.dependsOn([uploadArtifactory, uploadMavenCentral]) - - -gradle.taskGraph.whenReady { taskGraph -> - def hasRelease = taskGraph.hasTask('commitNewVersion') - def indexOf = { return taskGraph.allTasks.indexOf(it) } - - if (hasRelease) { - assert indexOf(build) < indexOf(unSnapshotVersion), 'build target has to be after unSnapshotVersion' - assert indexOf(uploadMavenCentral) < indexOf(preTagCommit), 'preTagCommit has to be after uploadMavenCentral' - assert indexOf(uploadArtifactory) < indexOf(preTagCommit), 'preTagCommit has to be after uploadArtifactory' - } -} - -// Prevent plugin from asking for a version number interactively -ext.'gradle.release.useAutomaticVersion' = "true" - -release { - git.requireBranch = null -} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index faa569a9a..c97a8bdb9 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d007c5527..4349a0db9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,22 +1,6 @@ -# -# Copyright 2014 Netflix, Inc. -# -# Licensed 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. -# - -#Tue Apr 01 17:23:21 PDT 2014 +#Thu Jan 08 14:57:15 PST 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-bin.zip