Custom plugin jar META-INF/gradle-plugins properties file not found Error


(Warren Muller) #1

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 {

mavenLocal()

}

dependencies {

classpath group: ‘com.spindrift’, name: ‘spindrift-gradle-plugins’, version: ‘0.1-SNAPSHOT’

} }

//apply plugin: ‘spindrift-gradle-plugins’ project.plugins.apply(‘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


(Szczepan Faber) #2

I suspect a typo in the path :slight_smile:

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

apply plugin: com.foo.bar.MyPlugin

Hope that helps!


(Warren Muller) #3

No typo :slight_smile:

Problem is resolved. Some more digging led me to a bug in JDK1.4

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6207022 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)


(Warren Muller) #4

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


(Doug Lethin) #5

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.


(Luke Daley) #6

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.


(Warren Muller) #7

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 tx


(Luke Daley) #8

I’ve turned this into a problem to be solved.


(Luke Daley) #9

Warren, can you please run with the -s option (show full stacktrace) and put the stacktrace here.


(Warren Muller) #10

Note: the Gradle build daemon is an experimental feature. As such, you may experience unexpected build failures. You may need to occasionally stop the daemon.

FAILURE: Build failed with an exception.

  • Where: Build file ‘/Users/warren/Documents/workspace/ProjectBuildReference/build.gradle’ line: 30

  • What went wrong: A problem occurred evaluating root project ‘ProjectBuildReference’. Cause: java.io.FileNotFoundException: JAR entry META-INF/gradle-plugins/SpindriftCommonPlugin.properties not found in /Users/warren/.m2/repository/com/spindrift/tools/gradle/plugins/SpindriftCommonPlugin/0.1-SNAPSHOT/SpindriftCommonPlugin-0.1-SNAPSHOT.jar

  • Try: Run with --info or --debug option to get more log output.

  • Exception is: org.gradle.api.GradleScriptException: A problem occurred evaluating root project ‘ProjectBuildReference’.

at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)

at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:127)

at org.gradle.configuration.BuildScriptProcessor.evaluate(BuildScriptProcessor.java:38)

at org.gradle.configuration.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:43)

at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:474)

at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:73)

at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:23)

at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:21)

at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuildConfigurer.java:38)

at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuildConfigurer.java:35)

at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:450)

at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:445)

at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:141)

at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)

at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)

at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:45)

at org.gradle.launcher.exec.DefaultGradleLauncherActionExecuter.execute(DefaultGradleLauncherActionExecuter.java:49)

at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:41)

at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)

at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:45)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)

at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:48)

at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)

at org.gradle.launcher.daemon.server.exec.HandleSleep.execute(HandleSleep.java:35)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)

at org.gradle.launcher.daemon.server.exec.ReportExceptions.execute(ReportExceptions.java:36)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)

at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)

at org.gradle.launcher.daemon.server.exec.ForwardOutput.execute(ForwardOutput.java:46)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)

at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:32)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)

at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:84)

at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:82)

at org.gradle.util.Swapper.swap(Swapper.java:38)

at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:82)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)

at org.gradle.launcher.daemon.server.exec.UpdateDaemonStateAndHandleBusyDaemon.execute(UpdateDaemonStateAndHandleBusyDaemon.java:33)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)

at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)

at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:34)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)

at org.gradle.launcher.daemon.server.exec.HandleClientDisconnectBeforeSendingCommand.execute(HandleClientDisconnectBeforeSendingCommand.java:21)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)

at org.gradle.launcher.daemon.server.exec.StopConnectionAfterExecution.execute(StopConnectionAfterExecution.java:21)

at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:116)

at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:47)

at org.gradle.launcher.daemon.server.Daemon$1$1.run(Daemon.java:103)

at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64) Caused by: org.gradle.api.UncheckedIOException: java.io.FileNotFoundException: JAR entry META-INF/gradle-plugins/SpindriftCommonPlugin.properties not found in /Users/warren/.m2/repository/com/spindrift/tools/gradle/plugins/SpindriftCommonPlugin/0.1-SNAPSHOT/SpindriftCommonPlugin-0.1-SNAPSHOT.jar

at org.gradle.util.GUtil.loadProperties(GUtil.java:214)

at org.gradle.api.internal.plugins.DefaultPluginRegistry.getTypeForId(DefaultPluginRegistry.java:92)

at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.getTypeForId(DefaultProjectsPluginContainer.java:102)

at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.apply(DefaultProjectsPluginContainer.java:37)

at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:101)

at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:32)

at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:72)

at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:114)

at org.gradle.api.internal.project.AbstractProject.apply(AbstractProject.java:841)

at org.gradle.api.Project$apply.call(Unknown Source)

at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:35)

at org.gradle.api.Script$apply.callCurrent(Unknown Source)

at build_6k8a6r5n6u7khnlhgke992otss.run(/Users/warren/Documents/workspace/ProjectBuildReference/build.gradle:30)

at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)

… 53 more Caused by: java.io.FileNotFoundException: JAR entry META-INF/gradle-plugins/SpindriftCommonPlugin.properties not found in /Users/warren/.m2/repository/com/spindrift/tools/gradle/plugins/SpindriftCommonPlugin/0.1-SNAPSHOT/SpindriftCommonPlugin-0.1-SNAPSHOT.jar

at org.gradle.util.GUtil.loadProperties(GUtil.java:212)

… 66 more

BUILD FAILED

Total time: 0.615 secs


(Warren Muller) #11

Even though the error says the .properties is not found thats misleading as its there. HTH


(Luke Daley) #12

The problem is that the JDK internally caches parts of JAR files. We are looking into it. The workaround for the time being is to not use the daemon.


(Youri Bonnaffé) #13

any news? I’m facing this issue right now with Gradle 1.7


(Warren Muller) #14

To be honest I have not had a problem for a long time now - we’re running on 1.6 and I do this quite often i.e. building the plugin in 1 tab and executing it in a test project in another from mavenLocal(). Its been very stable - however we don’t use the daemon that often - only when I remember :slight_smile: But I will test again when I upgrade to 1.7


(Youri Bonnaffé) #15

Indeed, for now I’m forced to not use the daemon, it is slow…er :slight_smile: I have the exact same setup as you too, building my plugin, installing in to local repo and then testing it right away.


(Warren Muller) #16

I’ve just run a test from on biggest project 1. Delete .gradle directory (not the ~/.gradle) 2. gradle clean build

1.6 : Total time: 2 mins 21.429 secs 1.7 : Total time: 3 mins 15.916 secs

That might not be a fair reflection but interesting to see if/what has slowed down in 1.7 as it was supposed to be a lot faster