| /* |
| * Licensed to the Apache Software Foundation (ASF) under one or more |
| * contributor license agreements. See the NOTICE file distributed with |
| * this work for additional information regarding copyright ownership. |
| * The ASF licenses this file to You 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 plugin: 'java-library' |
| // this is actually more of an 'application' but we don't want all of what Gradle adds |
| |
| description = 'Prometheus exporter for exposing metrics from Solr using Metrics API and Search API' |
| |
| dependencies { |
| implementation project(':solr:solrj') |
| |
| implementation ('io.prometheus:simpleclient') |
| implementation ('io.prometheus:simpleclient_common') |
| implementation ('io.prometheus:simpleclient_httpserver') |
| implementation ('net.thisptr:jackson-jq', { |
| exclude group: "org.jruby.joni", module: "joni" |
| }) |
| implementation ('net.sourceforge.argparse4j:argparse4j') |
| implementation ('com.github.ben-manes.caffeine:caffeine', { |
| exclude group: "org.checkerframework", module: "checker-qual" |
| exclude group: "com.google.errorprone", module: "error_prone_annotations" |
| }) |
| |
| runtimeOnly 'org.apache.logging.log4j:log4j-api' |
| runtimeOnly 'org.apache.logging.log4j:log4j-core' |
| runtimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl' |
| runtimeOnly 'com.lmax:disruptor' |
| |
| testImplementation project(':solr:test-framework') |
| } |
| |
| ext { |
| mainClass = 'org.apache.solr.prometheus.exporter.SolrExporter' |
| } |
| |
| task run(type: JavaExec) { |
| group = 'application' |
| description = 'Run the main class with JavaExecTask' |
| main = project.ext.mainClass |
| classpath = sourceSets.main.runtimeClasspath |
| systemProperties = ["log4j.configurationFile":"file:conf/log4j2.xml"] |
| } |
| |
| jar { |
| manifest { |
| attributes('Main-Class': project.ext.mainClass) |
| } |
| } |
| |
| assemblePackaging { |
| // Add two folders to default packaging. |
| from(projectDir, { |
| include "bin/**" |
| include "conf/**" |
| }) |
| // Add all libs except those provided by SolrJ & Logging |
| from ({ |
| def externalLibs = configurations.runtimeLibs.copyRecursive { dep -> |
| if (dep instanceof org.gradle.api.artifacts.ProjectDependency) { |
| return !dep.dependencyProject.path.startsWith(":solr") |
| } else { |
| return true |
| } |
| } |
| return externalLibs - project(':solr:server').configurations.getByName('libExt') |
| }, { |
| into "lib" |
| }) |
| |
| |
| into deps |
| } |