[GRADLE-2001] Custom plugin jar META-INF/gradle-plugins properties file not found Error Created: 13/Dec/11  Updated: 04/Jan/13  Resolved: 07/Mar/12

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 1.0-rc-1

Type: Bug
Reporter: Gradle Forums Assignee: Luke Daley
Resolution: Fixed Votes: 0


I'm creating a custom plugin. Following the docs I have created the class, add the META-INF/gradle-plugins .properties file, built and installed to my local .m2 repo.
Now testing in another project I have defined it in the build script as:
buildscript {
repositories {
dependencies {
classpath group: 'com.spindrift', name: 'spindrift-gradle-plugins', version: '0.1-SNAPSHOT'

//apply plugin: 'spindrift-gradle-plugins'

but when executing the build it throws:

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/warren/Documents/workspace/TestMyScripts/build.gradle' line: 13
  • What went wrong:
    A problem occurred evaluating root project 'TestMyScripts'.
    Cause: java.io.FileNotFoundException: JAR entry META-INF/gradle-plugins/spindrift-gradle-plugins.properties not found in /Users/warren/.m2/repository/com/spindrift/spindrift-gradle-plugins/0.1-SNAPSHOT/spindrift-gradle-plugins-0.1-SNAPSHOT.jar

But when I unjar that snapshot it exists correctly. The path to the snapshot is valid and the path to the .properties is valid.

Any ideas why it can't see/access the file - permissions are not a problem I think.
I am using Gradle 1.0-milestone-5

Comment by Gradle Forums [ 13/Dec/11 ]

I suspect a typo in the path

To avoid plugin id resolving and move forward you can apply plugin by class:

apply plugin: com.foo.bar.MyPlugin

Hope that helps!

Comment by Gradle Forums [ 13/Dec/11 ]

No typo

Problem is resolved. Some more digging led me to a bug in JDK1.4
and it seems its similar behaviour.
I have 2 windows
1 - I am building an installing the plugin to my local .m2 (this works fine)
2 - I am calling and testing in a test project.
So it fails sometimes. If I delete the .m2 entry and install again then it works fine, although sometime the gradle daemon fails so I have to run gradle -stop as well.
So cleanest sequence is
1. delete from .m2 repo
2. gradle install (from 1)
3. gradle build (or whatever) from 2)
[1] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6207022

Comment by Gradle Forums [ 13/Dec/11 ]

Just to be clear I'm not using 1.4 its just similar behaviour ...
I'm on 1.6 latest and m5

Comment by Gradle Forums [ 13/Dec/11 ]

I had a similar problem as you with the same error message. Took me a while to track it down, but in my case it was the gradle daemon that was the problem. Killing and restarting the daemon resolved the issue. What seems to be happening is that the daemon has the class loaded, but if the original file changes, the daemon gets all confused.

Comment by Gradle Forums [ 13/Dec/11 ]

Hi Warren,

Can you please confirm that you are using the Gradle daemon. If so, then I'm pretty sure that the JDK issue you found is the culprit. If this is the case I think we can workaround this in Gradle.

Comment by Gradle Forums [ 13/Dec/11 ]

Hi Luke,
Yes I am using the daemon. I normally have 2 window one for running gradle install with the maven plugin to push the new version to my .m2 repo. Then in the second I have the demo project and I do whatever gradle . If that task is from the plugin I have just updated it normally always fails. So the easiest path to this is I just stop the daemon then call my task again. If I don't stop the daemon I get the FNFE.
This is development on the Mac with version 1.6.0_29

Generated at Wed Jun 30 12:10:05 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.