bmuschko / gradle-clover-plugin

Gradle plugin for generating a code coverage report using Clover
Apache License 2.0
74 stars 49 forks source link

License issues in multi-project config #66

Closed jeeftor closed 7 years ago

jeeftor commented 9 years ago

I have a base project with 3 sub projects

In my base build.gradle I have added:

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.bmuschko:gradle-clover-plugin:2.0.1'
    }
}

allprojects {

   apply plugin: 'com.bmuschko.clover'

repositories {
  mavenCentral()
}

   dependencies {
    clover 'com.atlassian.clover:clover:4.0.5'
   }

}

When I do ./gradlew test it seems to make my my grade database and seems to find my clover.license file in the project root totally fine.

The issue i'm having is with:

./gradlew cloverAggregateDatabases ./gradlew agregateGenerateReport ./gradlew cloverGenerateReport

where they are reporting:

java.lang.RuntimeException: Invalid or missing License.. Please visit http://my.atlassian.com to obtain a valid license.

I'm assuming i'm missing something in my build.gradle files but I'm not sure where whether its in the parent or sub projects etc.

Thanks

jeeftor commented 9 years ago

It looks like the cloverAggregateDatabases command is being called by all these asks and its unable to find the correct license file... which is odd because when i run the test task it finds the license file fine ...

Alex-Vol commented 9 years ago

I think I understand the issue. The CloverReportTask injects the clover.license.path property in the ant instance when it executes but other tasks do not do that. If you execute the build is a way that the CloverReportTask is not up-to-date and in the same build invoke any of the other clover tasks then things work OK. The clover.license.path should be injected in all cases where the cloverlib.xml taskdef is instantiated.

jeeftor commented 9 years ago

So i did some more digging and I was able to get the clover working if i put the clover.license file in:

~/.gradle/caches/modules-2/files-2.1/com.atlassian.clover/clover/4.0.5/1f5108dfe4e613f2b4a9f5de5c6aa6f4f9fc4042/clover.license

Is that an easy fix to make with the license path fix?

Alex-Vol commented 9 years ago

I believe clover will look for the license in the classpath by default as a file resource by the name clover.license. What you did was in essence making clover.license be in the classpath. I made a quick fix for this in my fork and will issue a pull request as soon as I have a proper integration test for it.

ToYonos commented 7 years ago

Will the version 2.0.2 (including the fix) be pushed soon on jcenter ?

Alex-Vol-SV commented 7 years ago

Yes @ToYonos I plan to merge a few additional fixes that are ready and will do so in a timely manner. I just started working on this project and I am still learning the process.

Alex-Vol-SV commented 7 years ago

Merged pull request to master.