# Rule based configuration with custom java plugin

**URL:** <https://discuss.gradle.org/t/rule-based-configuration-with-custom-java-plugin/17169>\
**Category:** Help/Discuss\
**Tags:** software-model, plugins\
**Created:** [April 27, 2016, 6:09pm UTC](https://discuss.gradle.org/t/rule-based-configuration-with-custom-java-plugin/17169 "2016-04-27T18:09:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnscancella](https://avatars.discourse-cdn.com/v4/letter/j/e79b87/32.png) [@johnscancella](https://discuss.gradle.org/u/johnscancella)\
**Post date:** [April 27, 2016, 6:09pm UTC](https://discuss.gradle.org/t/rule-based-configuration-with-custom-java-plugin/17169/1 "2016-04-27T18:09:32Z")

</div>

Hello,

I have a created a custom plugin using java, and was wondering how I convert it to using the new rule based configuration. I have looked at your examples, but they are all in groovy so I am a little lost.

The first step was just to compile it (packaging for upload to the gradle plugins site is next), but it is complaining that it can’t find `package org.gradle.api does not exist`. In the “old way” I used the dependencies closure and added `gradleApi()`.

Here is what I have in my build script:

```gradle
plugins {
  id 'jvm-component'
  id 'java-lang'
  id 'junit-test-suite'
  id "eclipse"
}

repositories {
  jcenter()
}

model {
  components {
      main(JvmLibrarySpec){
        targetPlatform 'java8'
        dependencies {
          module 'org.slf4j:slf4j-api:1.7.18'
          module 'org.apache.httpcomponents:httpclient:4.5.1'
          module 'org.apache.httpcomponents:httpmime:4.5.1'
          module 'com.google.code.gson:gson:2.5'
// What goes here for gradleApi()?
        }
      }
  }
  testSuites {
    test(JUnitTestSuiteSpec) {
        jUnitVersion '4.12'
        dependencies {
          module 'org.mockito:mockito-core:1.10.19'
        }
    }
  }
}

```

Thanks for all the help!
