# Gradle plugins in artifactory

**URL:** <https://discuss.gradle.org/t/gradle-plugins-in-artifactory/45853>\
**Category:** Help/Discuss\
**Created:** [June 16, 2023, 7:59pm UTC](https://discuss.gradle.org/t/gradle-plugins-in-artifactory/45853 "2023-06-16T19:59:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ConstantLearning](https://avatars.discourse-cdn.com/v4/letter/c/b38774/32.png) [@ConstantLearning](https://discuss.gradle.org/u/ConstantLearning)\
**Post date:** [June 16, 2023, 7:59pm UTC](https://discuss.gradle.org/t/gradle-plugins-in-artifactory/45853/1 "2023-06-16T19:59:11Z")

</div>

I would like to setup my project so that everything gets downloaded via company’s internal artifactory repository (firewall blocks all other urls). Here is my settings.gradle :

```groovy
pluginManagement{
  repositories {
    maven {
      url = uri("...")
      credentials(HttpHeaderCredentials::class) {
     .
     .

      }
      authentication {
        create<HttpHeaderAuthentication>("header")
      }
    }
  }
}

```

When I run gradle build it still looks in Gradle Central Plugin repository for plugins, what am I missing?

```gradle
Error : 

* What went wrong:
Plugin [id: 'org.gradle.kotlin.kotlin-dsl', version: '4.0.7'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:4.0.7')
  Searched in the following repositories:
    Gradle Central Plugin Repository

```

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [June 17, 2023, 12:12am UTC](https://discuss.gradle.org/t/gradle-plugins-in-artifactory/45853/2 "2023-06-17T00:12:45Z")

</div>

You forgot to define the plugin repositories for the build that is building your convention plugins.

---

<div class="post-metadata">

**Author:** ![ConstantLearning](https://avatars.discourse-cdn.com/v4/letter/c/b38774/32.png) [@ConstantLearning](https://discuss.gradle.org/u/ConstantLearning)\
**Post date:** [June 19, 2023, 1:30pm UTC](https://discuss.gradle.org/t/gradle-plugins-in-artifactory/45853/3 "2023-06-19T13:30:17Z")

</div>

Sorry not sure I completely understand, could you please elaborate with an example?

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [June 19, 2023, 7:06pm UTC](https://discuss.gradle.org/t/gradle-plugins-in-artifactory/45853/4 "2023-06-19T19:06:49Z")

</div>

You use some convention plugins, either in `buildSrc` or in an included build.  
These are built by an own build where you need the repositories as normal production repositories to be able to build your plugin.  
You only defined it for the later stage where your convention plugin is applied to your main build.

---

<div class="post-metadata">

**Author:** ![ConstantLearning](https://avatars.discourse-cdn.com/v4/letter/c/b38774/32.png) [@ConstantLearning](https://discuss.gradle.org/u/ConstantLearning)\
**Post date:** [June 19, 2023, 7:24pm UTC](https://discuss.gradle.org/t/gradle-plugins-in-artifactory/45853/5 "2023-06-19T19:24:09Z")

</div>

I am using following plugins in buildSrc/build.gradle.kts  
plugins {  
`java-gradle-plugin`  
`kotlin-dsl`  
idea  
}

I have also defined similar custom repositories block like mentioned above for settings.gradle in this build.gradle as well but for some reason when I build its first trying to look for plugins in Gradle Central plugin repository, I want it to look directly in repository url I am providing (here I am using artifactory for example )

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [June 19, 2023, 11:58pm UTC](https://discuss.gradle.org/t/gradle-plugins-in-artifactory/45853/6 "2023-06-19T23:58:48Z")

</div>

As I said, `buildSrc` is a complete own build, did you define the repository in `pluginManagement` of `buildSrc/settings.gradle(.kts)`? Otherwise the plugins used to build `buildSrc` are looked up in the default, which is the plugin central.

---

<div class="post-metadata">

**Author:** ![ConstantLearning](https://avatars.discourse-cdn.com/v4/letter/c/b38774/32.png) [@ConstantLearning](https://discuss.gradle.org/u/ConstantLearning)\
**Post date:** [June 21, 2023, 3:11pm UTC](https://discuss.gradle.org/t/gradle-plugins-in-artifactory/45853/7 "2023-06-21T15:11:44Z")

</div>

Thank you , that was the missing piece. I was not defining pluginManagement inside buildSrc/settings.gradle.
