public class MyGradlePlugin implements Plugin<Project>{
*       Project project*

       public void apply(Project project) {
               project.getPlugins().apply(JavaPlugin.class);
                        ............
*               this.project = project*

*               project.version = ...*
*               project.group = ...*
*               project.repositories {*
*                     ...*
*               }*
           }
}

On Wed, Nov 2, 2011 at 5:19 AM, pranav <pran...@ivycomptech.com> wrote:

> Hi,
>
> There are about 50 modules and hence 50 build files. These are common for
> all the build files -
>
> sourceSets {
>    main {
>        java {
>            srcDir 'src/main'
>        }
>    }
>    test {
>            java {
>                srcDir 'src/test'
>            }
>    }
> }
>
> version = "1.0"
> group = "com.xxx.inhouse"
>
> repositories {
>    mavenRepo name: 'myCo', urls:
> "http://speke.xxx.co.in:8080/artifactory/myCo";
> }
>
> I want to move this common code to custom plug-in (Say MyPlugin)
>
> All the 50 build files would then use MyPlugin and give only the
> dependencies like
>
> apply plugin: 'myPlugin'
>
> dependencies {
>    compile group: 'log4j', name: 'log4j', version: '1.2.15', transitive:
> false
>    testCompile group: 'junit', name: 'junit', version: '4.9', transitive:
> false
> }
>
> I am using Java to write custom plugin in similar lines to JavaPlugin.
> Something like
>
> public class MyGradlePlugin implements Plugin<Project>{
>        public void apply(Project project) {
>                project.getPlugins().apply(JavaPlugin.class);
>                         ............
>            }
> }
>
> Now how do I set sourceSets, repositories, version, group etc using Java?
>
> Regards,
> Pranav
>
>
>
>
>
> --
> View this message in context:
> http://gradle.1045684.n5.nabble.com/Custom-plugin-tp4957556p4957556.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

Reply via email to