0

I'm trying to automate a build with the gradle tooling API that tests a custom plugin that I wrote, when I run the test steps manually invoking the gradle command line, all works as expected but when I run my integration tests, the following returns null on my plugin

contents = getClass().getResourceAsStream('/starters/starters-log4j.properties')

I think that the gradle tooling API is doing something funky with the classloading of my plugin but I don't have enough understanding on what could be happening.

What would be the correct way of either configuring the Tooling API to not mess my classloading or to load the resources from the plugin's classpath?

Charles
  • 50,943
  • 13
  • 104
  • 142
  • 1
    Can you tell us more about how is your integration test task configured and where did you put this resource? Generally I'd expect that adding it as `src//resources/starters/starters-log4j.properties` should work. – Radim Jun 04 '14 at 05:23
  • Hi Radim, the resource is in src/main/resources of my plugin's jar file and my integration test is leveraging the graddle connector `@Shared ProjectConnection connection = GradleConnector.newConnector().forProjectDirectory(new File(projectName)).connect()` note that if I include the resources in my integration tests's src/test/resources, the plugin is able to find these which is odd at least to me. – Juan Alberto López Cavallotti Jun 04 '14 at 11:10
  • Does the integration test gets a classpath that is superset of your compile classpath? I mean are configurations for your integration tests extending main configurations like in https://github.com/gradle/gradle/blob/master/gradle/integTest.gradle#L12 ? – Radim Jun 04 '14 at 12:15

0 Answers0