From aa7f29127554b63aac08b53cbfe88749fc9b0295 Mon Sep 17 00:00:00 2001
From: Sergio Zharinov <zharinov@users.noreply.github.com>
Date: Tue, 7 Apr 2020 14:05:27 +0400
Subject: [PATCH] =?UTF-8?q?feat(internal):=20datasource=20defaultRegistryU?=
 =?UTF-8?q?rls=20/=20appendRegistry=E2=80=A6=20(#5686)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/datasource/clojure/index.ts               |  7 ++
 lib/datasource/common.ts                      |  2 +
 lib/datasource/index.ts                       | 26 ++++--
 lib/datasource/maven/common.ts                |  2 -
 lib/datasource/maven/index.ts                 |  8 +-
 lib/datasource/maven/util.ts                  |  6 +-
 lib/datasource/pod/index.ts                   | 18 ++--
 lib/datasource/rubygems/index.ts              |  1 +
 lib/datasource/rubygems/releases.ts           |  8 +-
 lib/datasource/sbt-package/index.spec.ts      | 34 ++++----
 lib/datasource/sbt-package/index.ts           |  3 +
 lib/datasource/sbt-plugin/index.ts            |  6 +-
 .../__snapshots__/extract.spec.ts.snap        | 84 ++++++-------------
 lib/manager/deps-edn/extract.ts               |  7 +-
 .../__snapshots__/extract.spec.ts.snap        | 84 +++++--------------
 lib/manager/leiningen/extract.spec.ts         |  8 +-
 lib/manager/leiningen/extract.ts              |  7 +-
 17 files changed, 124 insertions(+), 187 deletions(-)
 create mode 100644 lib/datasource/clojure/index.ts

diff --git a/lib/datasource/clojure/index.ts b/lib/datasource/clojure/index.ts
new file mode 100644
index 0000000000..05dfdf989d
--- /dev/null
+++ b/lib/datasource/clojure/index.ts
@@ -0,0 +1,7 @@
+import { MAVEN_REPO } from '../maven/common';
+
+export const id = 'clojure';
+
+export const defaultRegistryUrls = ['https://clojars.org/repo', MAVEN_REPO];
+
+export { getReleases } from '../maven';
diff --git a/lib/datasource/common.ts b/lib/datasource/common.ts
index ebdc7116dc..8ae1040dbe 100644
--- a/lib/datasource/common.ts
+++ b/lib/datasource/common.ts
@@ -68,6 +68,8 @@ export interface Datasource {
   id: string;
   getDigest?(config: DigestConfig, newValue?: string): Promise<string | null>;
   getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null>;
+  defaultRegistryUrls?: string[];
+  appendRegistryUrls?: string[];
 }
 
 export class DatasourceError extends Error {
diff --git a/lib/datasource/index.ts b/lib/datasource/index.ts
index 7c69d2a6ed..7eb1ca8dc0 100644
--- a/lib/datasource/index.ts
+++ b/lib/datasource/index.ts
@@ -1,3 +1,4 @@
+import is from '@sindresorhus/is';
 import { logger } from '../logger';
 import { addMetaData } from './metadata';
 import * as allVersioning from '../versioning';
@@ -27,16 +28,31 @@ function load(datasource: string): Promise<Datasource> {
 
 type GetReleasesInternalConfig = GetReleasesConfig & GetPkgReleasesConfig;
 
+function resolveRegistryUrls(
+  datasource: Datasource,
+  extractedUrls: string[]
+): string[] {
+  const { defaultRegistryUrls = [], appendRegistryUrls = [] } = datasource;
+  return is.nonEmptyArray(extractedUrls)
+    ? [...extractedUrls, ...appendRegistryUrls]
+    : [...defaultRegistryUrls, ...appendRegistryUrls];
+}
+
 async function fetchReleases(
   config: GetReleasesInternalConfig
 ): Promise<ReleaseResult | null> {
-  const { datasource } = config;
-  if (!datasources.has(datasource)) {
-    logger.warn('Unknown datasource: ' + datasource);
+  const { datasource: datasourceName } = config;
+  if (!datasourceName || !datasources.has(datasourceName)) {
+    logger.warn('Unknown datasource: ' + datasourceName);
     return null;
   }
-  const dep = await (await load(datasource)).getReleases(config);
-  addMetaData(dep, datasource, config.lookupName);
+  const datasource = await load(datasourceName);
+  const registryUrls = resolveRegistryUrls(datasource, config.registryUrls);
+  const dep = await datasource.getReleases({
+    ...config,
+    registryUrls,
+  });
+  addMetaData(dep, datasourceName, config.lookupName);
   return dep;
 }
 
diff --git a/lib/datasource/maven/common.ts b/lib/datasource/maven/common.ts
index 5f0d7d808f..d516319326 100644
--- a/lib/datasource/maven/common.ts
+++ b/lib/datasource/maven/common.ts
@@ -1,5 +1,3 @@
 export const id = 'maven';
 
 export const MAVEN_REPO = 'https://repo.maven.apache.org/maven2';
-export const MAVEN_REPO_DEPRECATED = 'https://central.maven.org/maven2';
-export const CLOJARS_REPO = 'https://clojars.org/repo';
diff --git a/lib/datasource/maven/index.ts b/lib/datasource/maven/index.ts
index 9c93c87564..958e346a9b 100644
--- a/lib/datasource/maven/index.ts
+++ b/lib/datasource/maven/index.ts
@@ -1,4 +1,3 @@
-import is from '@sindresorhus/is';
 import url from 'url';
 import fs from 'fs-extra';
 import { XmlDocument } from 'xmldoc';
@@ -11,6 +10,8 @@ import { MAVEN_REPO } from './common';
 
 export { id } from './common';
 
+export const defaultRegistryUrls = [MAVEN_REPO];
+
 function containsPlaceholder(str: string): boolean {
   return /\${.*?}/g.test(str);
 }
@@ -146,10 +147,7 @@ export async function getReleases({
   lookupName,
   registryUrls,
 }: GetReleasesConfig): Promise<ReleaseResult | null> {
-  const registries = is.nonEmptyArray(registryUrls)
-    ? registryUrls
-    : [MAVEN_REPO];
-  const repositories = registries.map(repository =>
+  const repositories = registryUrls.map(repository =>
     repository.replace(/\/?$/, '/')
   );
   const dependency = getDependencyParts(lookupName);
diff --git a/lib/datasource/maven/util.ts b/lib/datasource/maven/util.ts
index aa1814739d..a80701dc5e 100644
--- a/lib/datasource/maven/util.ts
+++ b/lib/datasource/maven/util.ts
@@ -3,17 +3,15 @@ import { Http } from '../../util/http';
 import { logger } from '../../logger';
 import { DatasourceError } from '../common';
 
-import { id, MAVEN_REPO, MAVEN_REPO_DEPRECATED } from './common';
+import { id, MAVEN_REPO } from './common';
 
 const http = new Http(id);
 
 const getHost = (x: string): string => new url.URL(x).host;
 
-const defaultHosts = [MAVEN_REPO, MAVEN_REPO_DEPRECATED].map(getHost);
-
 function isMavenCentral(pkgUrl: url.URL | string): boolean {
   const host = typeof pkgUrl === 'string' ? pkgUrl : pkgUrl.host;
-  return defaultHosts.includes(host);
+  return getHost(MAVEN_REPO) === host;
 }
 
 function isTemporalError(err: { code: string; statusCode: number }): boolean {
diff --git a/lib/datasource/pod/index.ts b/lib/datasource/pod/index.ts
index e41dcbc50c..88a8408b49 100644
--- a/lib/datasource/pod/index.ts
+++ b/lib/datasource/pod/index.ts
@@ -5,6 +5,8 @@ import { logger } from '../../logger';
 
 export const id = 'pod';
 
+export const defaultRegistryUrls = ['https://cdn.cocoapods.org'];
+
 const cacheNamespace = `datasource-${id}`;
 const cacheMinutes = 30;
 
@@ -110,8 +112,6 @@ async function getReleasesFromCDN(
   return null;
 }
 
-const defaultCDN = 'https://cdn.cocoapods.org';
-
 function isDefaultRepo(url: string): boolean {
   const match = githubRegex.exec(url);
   if (match) {
@@ -123,14 +123,10 @@ function isDefaultRepo(url: string): boolean {
   return false;
 }
 
-export async function getReleases(
-  config: GetReleasesConfig
-): Promise<ReleaseResult | null> {
-  const { lookupName } = config;
-  let { registryUrls } = config;
-  registryUrls =
-    registryUrls && registryUrls.length ? registryUrls : [defaultCDN];
-
+export async function getReleases({
+  lookupName,
+  registryUrls,
+}: GetReleasesConfig): Promise<ReleaseResult | null> {
   const podName = lookupName.replace(/\/.*$/, '');
 
   const cachedResult = await renovateCache.get<ReleaseResult>(
@@ -149,7 +145,7 @@ export async function getReleases(
 
     // In order to not abuse github API limits, query CDN instead
     if (isDefaultRepo(registryUrl)) {
-      registryUrl = defaultCDN;
+      [registryUrl] = defaultRegistryUrls;
     }
 
     if (githubRegex.exec(registryUrl)) {
diff --git a/lib/datasource/rubygems/index.ts b/lib/datasource/rubygems/index.ts
index d4d80f7c2f..ddc9e60c98 100644
--- a/lib/datasource/rubygems/index.ts
+++ b/lib/datasource/rubygems/index.ts
@@ -1,2 +1,3 @@
 export { getReleases } from './releases';
 export { id } from './common';
+export const defaultRegistryUrls = ['https://rubygems.org'];
diff --git a/lib/datasource/rubygems/releases.ts b/lib/datasource/rubygems/releases.ts
index 5f558c65a5..3ed2ce1a04 100644
--- a/lib/datasource/rubygems/releases.ts
+++ b/lib/datasource/rubygems/releases.ts
@@ -1,4 +1,3 @@
-import is from '@sindresorhus/is';
 import { getDependency } from './get';
 import { getRubygemsOrgDependency } from './get-rubygems-org';
 import { GetReleasesConfig, ReleaseResult } from '../common';
@@ -7,12 +6,7 @@ export async function getReleases({
   lookupName,
   registryUrls,
 }: GetReleasesConfig): Promise<ReleaseResult | null> {
-  const defaultRegistry = 'https://rubygems.org';
-  const registries = is.nonEmptyArray(registryUrls)
-    ? registryUrls
-    : [defaultRegistry];
-
-  for (const registry of registries) {
+  for (const registry of registryUrls) {
     let pkg: ReleaseResult;
     // prettier-ignore
     if (registry.endsWith('rubygems.org')) { // lgtm [js/incomplete-url-substring-sanitization]
diff --git a/lib/datasource/sbt-package/index.spec.ts b/lib/datasource/sbt-package/index.spec.ts
index 308ffbaee0..c985c49c81 100644
--- a/lib/datasource/sbt-package/index.spec.ts
+++ b/lib/datasource/sbt-package/index.spec.ts
@@ -1,9 +1,11 @@
 import path from 'path';
 import fs from 'fs';
 import nock from 'nock';
-import { getReleases } from '.';
+import { getPkgReleases } from '..';
 import { MAVEN_REPO } from '../maven/common';
-import { parseIndexDir, SBT_PLUGINS_REPO } from '../sbt-plugin/util';
+import { parseIndexDir } from '../sbt-plugin/util';
+import * as sbtPlugin from '.';
+import * as mavenVersioning from '../../versioning/maven';
 
 const mavenIndexHtml = fs.readFileSync(
   path.resolve(__dirname, `./__fixtures__/maven-index.html`),
@@ -23,7 +25,7 @@ describe('datasource/sbt', () => {
     expect(parseIndexDir(sbtPluginIndex)).toMatchSnapshot();
   });
 
-  describe('getReleases', () => {
+  describe('getPkgReleases', () => {
     beforeEach(() => {
       nock.disableNetConnect();
       nock('https://failed_repo')
@@ -98,21 +100,21 @@ describe('datasource/sbt', () => {
 
     it('returns null in case of errors', async () => {
       expect(
-        await getReleases({
-          lookupName: 'org.scalatest:scalatest',
+        await getPkgReleases({
+          versioning: mavenVersioning.id,
+          datasource: sbtPlugin.id,
+          depName: 'org.scalatest:scalatest',
           registryUrls: ['https://failed_repo/maven'],
         })
       ).toEqual(null);
     });
     it('fetches releases from Maven', async () => {
       expect(
-        await getReleases({
-          lookupName: 'org.scalatest:scalatest',
-          registryUrls: [
-            'https://failed_repo/maven',
-            MAVEN_REPO,
-            SBT_PLUGINS_REPO,
-          ],
+        await getPkgReleases({
+          versioning: mavenVersioning.id,
+          datasource: sbtPlugin.id,
+          depName: 'org.scalatest:scalatest',
+          registryUrls: ['https://failed_repo/maven', MAVEN_REPO],
         })
       ).toEqual({
         dependencyUrl: 'https://repo.maven.apache.org/maven2/org/scalatest',
@@ -122,9 +124,11 @@ describe('datasource/sbt', () => {
         releases: [{ version: '1.2.0' }, { version: '1.2.3' }],
       });
       expect(
-        await getReleases({
-          lookupName: 'org.scalatest:scalatest_2.12',
-          registryUrls: [MAVEN_REPO, SBT_PLUGINS_REPO],
+        await getPkgReleases({
+          versioning: mavenVersioning.id,
+          datasource: sbtPlugin.id,
+          depName: 'org.scalatest:scalatest_2.12',
+          registryUrls: [],
         })
       ).toEqual({
         dependencyUrl: 'https://repo.maven.apache.org/maven2/org/scalatest',
diff --git a/lib/datasource/sbt-package/index.ts b/lib/datasource/sbt-package/index.ts
index 4976c2ac8f..011e490dab 100644
--- a/lib/datasource/sbt-package/index.ts
+++ b/lib/datasource/sbt-package/index.ts
@@ -3,9 +3,12 @@ import { downloadHttpProtocol } from '../maven/util';
 import { parseIndexDir } from '../sbt-plugin/util';
 import { logger } from '../../logger';
 import { GetReleasesConfig, ReleaseResult } from '../common';
+import { MAVEN_REPO } from '../maven/common';
 
 export const id = 'sbt-package';
 
+export const defaultRegistryUrls = [MAVEN_REPO];
+
 const ensureTrailingSlash = (str: string): string => str.replace(/\/?$/, '/');
 
 export async function resolvePackageReleases(
diff --git a/lib/datasource/sbt-plugin/index.ts b/lib/datasource/sbt-plugin/index.ts
index 5626429532..99fca4260f 100644
--- a/lib/datasource/sbt-plugin/index.ts
+++ b/lib/datasource/sbt-plugin/index.ts
@@ -7,6 +7,8 @@ import { resolvePackageReleases } from '../sbt-package';
 
 export const id = 'sbt-plugin';
 
+export const defaultRegistryUrls = [SBT_PLUGINS_REPO];
+
 const ensureTrailingSlash = (str: string): string => str.replace(/\/?$/, '/');
 
 async function resolvePluginReleases(
@@ -58,10 +60,8 @@ async function resolvePluginReleases(
 
 export async function getReleases({
   lookupName,
-  registryUrls: configRegistryUrls,
+  registryUrls,
 }: GetReleasesConfig): Promise<ReleaseResult | null> {
-  const registryUrls = [SBT_PLUGINS_REPO, ...configRegistryUrls];
-
   const [groupId, artifactId] = lookupName.split(':');
   const groupIdSplit = groupId.split('.');
   const artifactIdSplit = artifactId.split('_');
diff --git a/lib/manager/deps-edn/__snapshots__/extract.spec.ts.snap b/lib/manager/deps-edn/__snapshots__/extract.spec.ts.snap
index 9924dd41aa..691c60ed69 100644
--- a/lib/manager/deps-edn/__snapshots__/extract.spec.ts.snap
+++ b/lib/manager/deps-edn/__snapshots__/extract.spec.ts.snap
@@ -5,123 +5,87 @@ Object {
   "deps": Array [
     Object {
       "currentValue": "0.1.2",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "persistent-sorted-set:persistent-sorted-set",
       "fileReplacePosition": 53,
-      "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
-      ],
+      "registryUrls": Array [],
     },
     Object {
       "currentValue": "1.9.0",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "org.clojure:clojure",
       "fileReplacePosition": 147,
-      "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
-      ],
+      "registryUrls": Array [],
     },
     Object {
       "currentValue": "1.10.0",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "org.clojure:clojure",
       "fileReplacePosition": 241,
-      "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
-      ],
+      "registryUrls": Array [],
     },
     Object {
       "currentValue": "1.10.520",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "org.clojure:clojurescript",
       "fileReplacePosition": 389,
-      "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
-      ],
+      "registryUrls": Array [],
     },
     Object {
       "currentValue": "0.2.11",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "org.clojure:tools.namespace",
       "fileReplacePosition": 451,
-      "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
-      ],
+      "registryUrls": Array [],
     },
     Object {
       "currentValue": "1.10.520",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "org.clojure:clojurescript",
       "fileReplacePosition": 584,
-      "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
-      ],
+      "registryUrls": Array [],
     },
     Object {
       "currentValue": "0.0-389",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "lambdaisland:kaocha",
       "fileReplacePosition": 644,
-      "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
-      ],
+      "registryUrls": Array [],
     },
     Object {
       "currentValue": "0.0-21",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "lambdaisland:kaocha-cljs",
       "fileReplacePosition": 703,
-      "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
-      ],
+      "registryUrls": Array [],
     },
     Object {
       "currentValue": "0.21.1",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "cider:cider-nrepl",
       "fileReplacePosition": 810,
-      "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
-      ],
+      "registryUrls": Array [],
     },
     Object {
       "currentValue": "0.6.0",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "nrepl:nrepl",
       "fileReplacePosition": 870,
-      "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
-      ],
+      "registryUrls": Array [],
     },
     Object {
       "currentValue": "0.2.11",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "org.clojure:tools.namespace",
       "fileReplacePosition": 929,
-      "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
-      ],
+      "registryUrls": Array [],
     },
     Object {
       "currentValue": "0.9.5703",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "com.datomic:datomic-free",
       "fileReplacePosition": 1141,
-      "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
-      ],
+      "registryUrls": Array [],
     },
   ],
 }
diff --git a/lib/manager/deps-edn/extract.ts b/lib/manager/deps-edn/extract.ts
index 49435c9394..0c451815b5 100644
--- a/lib/manager/deps-edn/extract.ts
+++ b/lib/manager/deps-edn/extract.ts
@@ -1,7 +1,6 @@
-import { CLOJARS_REPO, MAVEN_REPO } from '../../datasource/maven/common';
 import { expandDepName } from '../leiningen/extract';
 import { PackageFile, PackageDependency } from '../common';
-import * as datasourceMaven from '../../datasource/maven';
+import * as datasourceClojure from '../../datasource/clojure';
 
 export function extractPackageFile(content: string): PackageFile {
   const deps: PackageDependency[] = [];
@@ -20,11 +19,11 @@ export function extractPackageFile(content: string): PackageFile {
     match = regex.exec(rest);
 
     deps.push({
-      datasource: datasourceMaven.id,
+      datasource: datasourceClojure.id,
       depName: expandDepName(depName),
       currentValue,
       fileReplacePosition,
-      registryUrls: [CLOJARS_REPO, MAVEN_REPO],
+      registryUrls: [],
     });
   }
 
diff --git a/lib/manager/leiningen/__snapshots__/extract.spec.ts.snap b/lib/manager/leiningen/__snapshots__/extract.spec.ts.snap
index f229cd5bf1..d3d21a15a7 100644
--- a/lib/manager/leiningen/__snapshots__/extract.spec.ts.snap
+++ b/lib/manager/leiningen/__snapshots__/extract.spec.ts.snap
@@ -5,13 +5,11 @@ Object {
   "deps": Array [
     Object {
       "currentValue": "1.3.0",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "org.clojure:clojure",
       "depType": "dependencies",
       "fileReplacePosition": 2747,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -20,13 +18,11 @@ Object {
     },
     Object {
       "currentValue": "1.0",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "org.jclouds:jclouds",
       "depType": "dependencies",
       "fileReplacePosition": 2794,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -35,13 +31,11 @@ Object {
     },
     Object {
       "currentValue": "2.3.1",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "net.sf.ehcache:ehcache",
       "depType": "dependencies",
       "fileReplacePosition": 2862,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -50,13 +44,11 @@ Object {
     },
     Object {
       "currentValue": "1.2.15",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "log4j:log4j",
       "depType": "dependencies",
       "fileReplacePosition": 2912,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -65,13 +57,11 @@ Object {
     },
     Object {
       "currentValue": "3.0.2",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "net.3scale:3scale-api",
       "depType": "dependencies",
       "fileReplacePosition": 3223,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -80,13 +70,11 @@ Object {
     },
     Object {
       "currentValue": "2.8.5",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "org.lwjgl.lwjgl:lwjgl",
       "depType": "dependencies",
       "fileReplacePosition": 3272,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -95,13 +83,11 @@ Object {
     },
     Object {
       "currentValue": "2.8.5",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "org.lwjgl.lwjgl:lwjgl-platform",
       "depType": "dependencies",
       "fileReplacePosition": 3330,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -110,13 +96,11 @@ Object {
     },
     Object {
       "currentValue": "1.4.0",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "org.clojure:clojure",
       "depType": "dependencies",
       "fileReplacePosition": 11073,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -125,13 +109,11 @@ Object {
     },
     Object {
       "currentValue": "1.5.0",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "org.clojure:clojure",
       "depType": "dependencies",
       "fileReplacePosition": 11139,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -140,13 +122,11 @@ Object {
     },
     Object {
       "currentValue": "0.2.4",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "clj-stacktrace:clj-stacktrace",
       "depType": "dependencies",
       "fileReplacePosition": 11287,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -155,13 +135,11 @@ Object {
     },
     Object {
       "currentValue": "0.12.0",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "clj-time:clj-time",
       "depType": "managed-dependencies",
       "fileReplacePosition": 4705,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -170,13 +148,11 @@ Object {
     },
     Object {
       "currentValue": "1.4.6",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "me.raynes:fs",
       "depType": "managed-dependencies",
       "fileReplacePosition": 4754,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -185,13 +161,11 @@ Object {
     },
     Object {
       "currentValue": "1.1.1",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "lein-pprint:lein-pprint",
       "depType": "plugins",
       "fileReplacePosition": 5558,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -200,13 +174,11 @@ Object {
     },
     Object {
       "currentValue": "0.1.0",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "lein-assoc:lein-assoc",
       "depType": "plugins",
       "fileReplacePosition": 5591,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -215,13 +187,11 @@ Object {
     },
     Object {
       "currentValue": "1.1.1",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "s3-wagon-private:s3-wagon-private",
       "depType": "plugins",
       "fileReplacePosition": 5630,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -230,13 +200,11 @@ Object {
     },
     Object {
       "currentValue": "0.0.1",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "lein-foo:lein-foo",
       "depType": "plugins",
       "fileReplacePosition": 5661,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -245,13 +213,11 @@ Object {
     },
     Object {
       "currentValue": "0.0.1",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "lein-bar:lein-bar",
       "depType": "plugins",
       "fileReplacePosition": 5705,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -260,13 +226,11 @@ Object {
     },
     Object {
       "currentValue": "0.7.1",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "cider:cider-nrepl",
       "depType": "plugins",
       "fileReplacePosition": 11489,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -275,13 +239,11 @@ Object {
     },
     Object {
       "currentValue": "1.3.13",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "com.theoryinpractise:clojure-maven-plugin",
       "depType": "pom-plugins",
       "fileReplacePosition": 26925,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -290,13 +252,11 @@ Object {
     },
     Object {
       "currentValue": "2.1",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "org.apache.tomcat.maven:tomcat7-maven-plugin",
       "depType": "pom-plugins",
       "fileReplacePosition": 27372,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
@@ -305,13 +265,11 @@ Object {
     },
     Object {
       "currentValue": "1.9.68",
-      "datasource": "maven",
+      "datasource": "clojure",
       "depName": "com.google.appengine:appengine-maven-plugin",
       "depType": "pom-plugins",
       "fileReplacePosition": 27440,
       "registryUrls": Array [
-        "https://clojars.org/repo",
-        "https://repo.maven.apache.org/maven2",
         "https://download.java.net/maven/2",
         "https://oss.sonatype.org/content/repositories/releases",
         "https://blueant.com/archiva/snapshots",
diff --git a/lib/manager/leiningen/extract.spec.ts b/lib/manager/leiningen/extract.spec.ts
index 7bff374f5f..33ec4b5300 100644
--- a/lib/manager/leiningen/extract.spec.ts
+++ b/lib/manager/leiningen/extract.spec.ts
@@ -2,7 +2,7 @@
 import { readFileSync } from 'fs';
 import { resolve } from 'path';
 import { trimAtKey, extractFromVectors, extractPackageFile } from './extract';
-import * as datasourceMaven from '../../datasource/maven';
+import * as datasourceClojure from '../../datasource/clojure';
 
 const leinProjectClj = readFileSync(
   resolve(__dirname, `./__fixtures__/project.clj`),
@@ -23,7 +23,7 @@ describe('manager/clojure/extract', () => {
     expect(extractFromVectors('[[]]')).toEqual([]);
     expect(extractFromVectors('[[foo/bar "1.2.3"]]')).toEqual([
       {
-        datasource: datasourceMaven.id,
+        datasource: datasourceClojure.id,
         depName: 'foo:bar',
         currentValue: '1.2.3',
         fileReplacePosition: 11,
@@ -33,13 +33,13 @@ describe('manager/clojure/extract', () => {
       extractFromVectors('[\t[foo/bar "1.2.3"]\n["foo/baz"  "4.5.6"] ]')
     ).toEqual([
       {
-        datasource: datasourceMaven.id,
+        datasource: datasourceClojure.id,
         depName: 'foo:bar',
         currentValue: '1.2.3',
         fileReplacePosition: 12,
       },
       {
-        datasource: datasourceMaven.id,
+        datasource: datasourceClojure.id,
         depName: 'foo:baz',
         currentValue: '4.5.6',
         fileReplacePosition: 33,
diff --git a/lib/manager/leiningen/extract.ts b/lib/manager/leiningen/extract.ts
index ef930a2d1c..8404a462f8 100644
--- a/lib/manager/leiningen/extract.ts
+++ b/lib/manager/leiningen/extract.ts
@@ -1,6 +1,5 @@
-import { CLOJARS_REPO, MAVEN_REPO } from '../../datasource/maven/common';
 import { PackageDependency, PackageFile } from '../common';
-import * as datasourceMaven from '../../datasource/maven';
+import * as datasourceClojure from '../../datasource/clojure';
 
 export function trimAtKey(str: string, kwName: string): string | null {
   const regex = new RegExp(`:${kwName}(?=\\s)`);
@@ -50,7 +49,7 @@ export function extractFromVectors(
     if (artifactId && version && fileReplacePosition) {
       result.push({
         ...ctx,
-        datasource: datasourceMaven.id,
+        datasource: datasourceClojure.id,
         depName: expandDepName(cleanStrLiteral(artifactId)),
         currentValue: cleanStrLiteral(version),
         fileReplacePosition,
@@ -96,7 +95,7 @@ export function extractFromVectors(
 }
 
 function extractLeinRepos(content: string): string[] {
-  const result = [CLOJARS_REPO, MAVEN_REPO];
+  const result = [];
 
   const repoContent = trimAtKey(
     content.replace(/;;.*(?=[\r\n])/g, ''), // get rid of comments
-- 
GitLab