opengl-8080 / assertjGen-gradle-plugin

Gradle plugin that generate AssertJ assertion class.
MIT License
10 stars 0 forks source link

Question: How to add configuration parameters #6

Open cwiejack opened 7 years ago

cwiejack commented 7 years ago

Hi, I'm new using Gradle and AssertJ. Reading the docs for AssertJ there are a lot of configuration parameters for the Maven Plugin. (i.e. includes, excludes). How do I configure this with the Gradle Plugin?

Regards Christian

opengl-8080 commented 7 years ago

assertjGen-gradle-plugin does not support parameters like Maven plugin. This plugin wraps this example simply.

This plugin has few parameters. classOrPackageNames, outputDir, assertjGenerator, cleanOnlyFiles and cleanFilesPattern. Please refer README.md for details.

If you want to include some classes and to exclude some classes, please use classOrPackageNames alternativly.

For example.

project structure

|-build.gradle
`-src/
  `-main/java/
     |-foo/  : this package has no classes to generate assertion classes.
     `-bar/  : this package has classes to generate assertion classes.

build.gradle

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.com.github.opengl-8080:assertjGen-gradle-plugin:1.1.2"
  }
}

apply plugin: "com.github.opengl-BOBO.assertjGen"

assertjGen {
    classOrPackageNames = ['bar'] // **set target packages.**
}

sourceSets {
    test.java {
        srcDir assertjGen.outputDir
    }
}

We needs to implement new parameters, if you face to more complex situations. For example, bar package has both target classes and non target classes.

cwiejack commented 7 years ago

Hi, thanks for your reply. I have exactly the situation where I have target and non target classes in one package. I will have a look at the example you mentioned.