赞
踩
最近在进阶技能,想看一下Gradle Plugin开发,以前总觉得plugin牛B,现在自己开始着手写写gradle plugin,但是,一开始写就碰到了问题:
18:13:44.478 [QUIET] [system.out] Task spend time: 18:13:44.478 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1 completed (0 worker(s) in use) 18:13:44.478 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Daemon worker Thread 5: released lock on root.1 18:13:44.479 18:13:44.479 FAILURE: Build failed with an exception. 18:13:44.479 18:13:44.479 * Where: 18:13:44.479 Build file 'D:\study\AOPDemo\app\build.gradle' line: 52 18:13:44.479 18:13:44.479 * What went wrong: 18:13:44.479 A problem occurred evaluating project ':app'. 18:13:44.479 > Failed to apply plugin [class 'GreetingPlugin'] 18:13:44.480 > No such property: project for class: GreetingPlugin 18:13:44.480 18:13:44.480 * Try: 18:13:44.480 Run with --scan to get full insights. 18:13:44.480 18:13:44.480 * Exception is: 18:13:44.482 org.gradle.api.GradleScriptException: A problem occurred evaluating project ':app'. 18:13:44.482 at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:92) 18:13:44.482 at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$2.run(DefaultScriptPluginFactory.java:206) 18:13:44.482 at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:77) 18:13:44.482 at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:211) 18:13:44.482 at org.gradle.configuration.BuildOperationScriptPlugin$1$1.run(BuildOperationScriptPlugin.java:69) 18:13:44.482 at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301) 18:13:44.482 at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293) 18:13:44.482 at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175) 18:13:44.482 at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91) 18:13:44.482 at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31) 18:13:44.482 at org.gradle.configuration.BuildOperationScriptPlugin$1.execute(BuildOperationScriptPlugin.java:66) 18:13:44.482 at org.gradle.configuration.BuildOperationScriptPlugin$1.execute(BuildOperationScriptPlugin.java:63) 18:13:44.482 at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:48) 18:13:44.482 at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:63) 18:13:44.482 at org.gradle.configuration.project.BuildScriptProcessor$1.run(BuildScriptProcessor.java:44) 18:13:44.483 at org.gradle.internal.Factories$1.create(Factories.java:25) 18:13:44.483 at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:200) 18:13:44.483 at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:186) 18:13:44.483 at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:41) 18:13:44.483 at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26) 18:13:44.483 at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34) 18:13:44.483 at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject$1.run(LifecycleProjectEvaluator.java:106) 18:13:44.483 at org.gradle.internal.Factories$1.create(Factories.java:25) 18:13:44.483 at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:183) 18:13:44.483 at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40) 18:13:44.483 at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withProjectLock(DefaultProjectStateRegistry.java:226) 18:13:44.483 at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:220) 18:13:44.483 at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:186) 18:13:44.483 at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject.run(LifecycleProjectEvaluator.java:95) 18:13:44.483 at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301) 18:13:44.483 at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293) 18:13:44.483 at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175) 18:13:44.483 at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91) 18:13:44.483 at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31) 18:13:44.483 at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:67) 18:13:44.483 at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:693) 18:13:44.483 at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:141) 18:13:44.483 at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:35) 18:13:44.483 at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:62) 18:13:44.483 at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:41) 18:13:44.483 at org.gradle.initialization.DefaultGradleLauncher$ConfigureBuild.run(DefaultGradleLauncher.java:302) 18:13:44.483 at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301) 18:13:44.483 at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293) 18:13:44.484 at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175) 18:13:44.484 at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91) 18:13:44.484 at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31) 18:13:44.484 at org.gradle.initialization.DefaultGradleLauncher.configureBuild(DefaultGradleLauncher.java:210) 18:13:44.484 at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151) 18:13:44.484 at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:134) 18:13:44.484 at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:58) 18:13:44.484 at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:55) 18:13:44.484 at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:82) 18:13:44.484 at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:75) 18:13:44.484 at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:183) 18:13:44.484 at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40) 18:13:44.484 at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:75) 18:13:44.484 at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:55) 18:13:44.484 at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:31) 18:13:44.484 at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) 18:13:44.484 at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:58) 18:13:44.484 at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32) 18:13:44.484 at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:39) 18:13:44.484 at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:49) 18:13:44.484 at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:44) 18:13:44.484 at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:315) 18:13:44.484 at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:305) 18:13:44.485 at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175) 18:13:44.485 at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:101) 18:13:44.485 at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36) 18:13:44.485 at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:44) 18:13:44.485 at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:49) 18:13:44.485 at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:46) 18:13:44.485 at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:78) 18:13:44.485 at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:46) 18:13:44.485 at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:31) 18:13:44.485 at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:42) 18:13:44.485 at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:28) 18:13:44.485 at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78) 18:13:44.485 at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:52) 18:13:44.485 at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:59) 18:13:44.485 at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:36) 18:13:44.485 at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:68) 18:13:44.485 at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:38) 18:13:44.485 at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:37) 18:13:44.485 at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:26) 18:13:44.485 at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43) 18:13:44.485 at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29) 18:13:44.485 at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:60) 18:13:44.485 at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:32) 18:13:44.485 at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55) 18:13:44.485 at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:41) 18:13:44.486 at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:48) 18:13:44.486 at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:32) 18:13:44.486 at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67) 18:13:44.486 at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 18:13:44.486 at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) 18:13:44.486 at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37) 18:13:44.486 at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) 18:13:44.486 at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26) 18:13:44.486 at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) 18:13:44.486 at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34) 18:13:44.486 at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) 18:13:44.486 at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74) 18:13:44.486 at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72) 18:13:44.486 at org.gradle.util.Swapper.swap(Swapper.java:38) 18:13:44.486 at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72) 18:13:44.486 at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) 18:13:44.486 at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55) 18:13:44.486 at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) 18:13:44.486 at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62) 18:13:44.487 at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 18:13:44.487 at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) 18:13:44.487 at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:81) 18:13:44.487 at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 18:13:44.487 at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) 18:13:44.487 at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50) 18:13:44.487 at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295) 18:13:44.487 at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) 18:13:44.487 at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) 18:13:44.487 at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) 18:13:44.487 Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [class 'GreetingPlugin'] 18:13:44.487 at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:163) 18:13:44.487 at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:137) 18:13:44.487 at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyType(DefaultObjectConfigurationAction.java:130) 18:13:44.487 at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:114) 18:13:44.488 at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$100(DefaultObjectConfigurationAction.java:38) 18:13:44.488 at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$2.run(DefaultObjectConfigurationAction.java:77) 18:13:44.488 at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:143) 18:13:44.488 at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:46) 18:13:44.488 at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.java:34) 18:13:44.488 at org.gradle.api.Script$apply$0.callCurrent(Unknown Source) 18:13:44.488 at build_1c5opngy8ng8c02hv61dtcvl2.run(D:\study\AOPDemo\app\build.gradle:62) 18:13:44.488 at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:90) 18:13:44.488 ... 119 more 18:13:44.488 Caused by: groovy.lang.MissingPropertyException: No such property: project for class: GreetingPlugin 18:13:44.488 at GreetingPlugin.apply(D:\study\AOPDemo\app\build.gradle:52) 18:13:44.488 at GreetingPlugin.apply(D:\study\AOPDemo\app\build.gradle) 18:13:44.488 at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:42) 18:13:44.488 at org.gradle.api.internal.plugins.RuleBasedPluginTarget.applyImperative(RuleBasedPluginTarget.java:50) 18:13:44.488 at org.gradle.api.internal.plugins.DefaultPluginManager.addPlugin(DefaultPluginManager.java:177) 18:13:44.488 at org.gradle.api.internal.plugins.DefaultPluginManager.access$300(DefaultPluginManager.java:51) 18:13:44.488 at org.gradle.api.internal.plugins.DefaultPluginManager$AddPluginBuildOperation.run(DefaultPluginManager.java:267) 18:13:44.488 at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExec utor.java:301) 18:13:44.488 at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExec utor.java:293) 18:13:44.488 at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175) 18:13:44.488 at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91) 18:13:44.489 at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31) 18:13:44.489 at org.gradle.api.internal.plugins.DefaultPluginManager$2.execute(DefaultPluginManager.java:155) 18:13:44.489 at org.gradle.api.internal.plugins.DefaultPluginManager$2.execute(DefaultPluginManager.java:152) 18:13:44.489 at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:48) 18:13:44.489 at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:152) 18:13:44.489 ... 130 more 18:13:44.489 18:13:44.489 18:13:44.489 * Get more help at https://help.gradle.org 18:13:44.489 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] 18:13:44.489 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 4s 18:13:44.489 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Run build' 18:13:44.489 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Run build' completed 18:13:44.495 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for Build Output Cleanup Cache (D:\study\AOPDemo\.gradle\buildOutputCleanup) 18:13:44.495 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on Build Output Cleanup Cache (D:\study\AOPDemo\.gradle\buildOutputCleanup). 18:13:44.497 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for cache directory md-supplier (D:\Program Files\Android\.gradle\caches\5.1.1\md-supplier) 18:13:44.498 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on cache directory md-supplier (D:\Program Files\Android\.gradle\caches\5.1.1\md-supplier). 18:13:44.499 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for cache directory md-rule (D:\Program Files\Android\.gradle\caches\5.1.1\md-rule) 18:13:44.499 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on cache directory md-rule (D:\Program Files\Android\.gradle\caches\5.1.1\md-rule). 18:13:44.501 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory] Resolution result cache closed. Cache reads: 0, disk reads: 0 (avg: 0.0 secs, total: 0.0 secs) 18:13:44.517 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory] Resolution result cache closed. Cache reads: 0, disk reads: 0 (avg: 0.0 secs, total: 0.0 secs) 18:13:44.517 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.ResolutionResultsStoreFactory] Deleted 2 resolution results binary files in 0.016 secs 18:13:44.518 [DEBUG] [org.gradle.deployment.internal.DefaultDeploymentRegistry] Stopping 0 deployment handles 18:13:44.518 [DEBUG] [org.gradle.deployment.internal.DefaultDeploymentRegistry] Stopped deployment handles 18:13:44.519 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for file hash cache (D:\study\AOPDemo\.gradle\5.1.1\fileHashes) 18:13:44.519 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on file hash cache (D:\study\AOPDemo\.gradle\5.1.1\fileHashes). 18:13:44.521 [DEBUG] [org.gradle.cache.internal.DefaultPersistentDirectoryStore] VCS Checkout Cache (D:\study\AOPDemo\.gradle\vcs-1) has last been fully cleaned up 8 hours ago 18:13:44.521 [DEBUG] [org.gradle.cache.internal.DefaultCacheAccess] Cache VCS Checkout Cache (D:\study\AOPDemo\.gradle\vcs-1) was closed 0 times. 18:13:44.521 [DEBUG] [org.gradle.cache.internal.DefaultCacheAccess] Cache VCS metadata (D:\study\AOPDemo\.gradle\5.1.1\vcsMetadata-1) was closed 0 times. 18:13:44.533 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] The daemon has finished executing the build. 18:13:44.625 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientInputForwarder] Dispatching close input message: org.gradle.launcher.daemon.protocol.CloseInput@453fd943 18:13:45.039 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 15: dispatching class org.gradle.launcher.daemon.protocol.CloseInput 18:13:45.041 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClient] Received result Success[value=org.gradle.launcher.exec.BuildActionResult@37883b97] from daemon DaemonInfo{pid=10576, address=[689e60e4-e 4c1-4bf9-8bad-246cf2ae1c5f port:55587, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1571738772306, context=DefaultDaemonContext[uid=26cac639-0765-4dd8-9b73-8fd46767b601,javaHome=D:\Androi d\Java\jdk1.8.0_181,daemonRegistryDir=D:\Program Files\Android\.gradle\daemon,pid=10576,idleTimeout=10800000,priority=NORMAL,daemonOpts=-noverify,-Xmx1536m,-Dfile.encoding=GBK,-Duser.country=CN,-Duser.langu age=zh,-Duser.variant]} (build should be done). 18:13:45.042 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: dispatching class org.gradle.launcher.daemon.protocol.Finished 18:13:45.043 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: connection stop
看到这些东西就头痛!!!!
大致看下了意思是说,GreetingPlugin插件中没有project属性。
先看看代码:
class GreetingPluginExtension{ String message = "Hello from GreetingPlugin" } class GreetingPlugin implements Plugin<Project>{ @Override void apply(Project target) { def extension = project.extensions.create('greeting',GreetingPluginExtension) project.task('hello'){ doLast { println extension.message } } } } apply plugin: GreetingPlugin //应用插件,这样插件才能在gradle构建过程中生效。
看到apply方法,发现project确实没有这个属性,但是系统貌似不会提示,这个很是让人糟心。修改一下属性就ok了:
@Override
void apply(Project target) {
def extension = target.extensions.create('greeting',GreetingPluginExtension)
target.task('hello'){
doLast {
println extension.message
}
}
}
这是我的一个小疏忽,但是不管怎么样,以后遇到属性不匹配的问题,还是要好好检查自己的代码。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。