groovy

'include' of functions in groovy scripts

泪湿孤枕 提交于 2020-02-24 14:57:12
问题 I'm writing a number of scripts in groovy. And I need some kind of code reuse in my scripts. How can I do it? I can put this code in a class. But it is hardly to support solution - part of code is in the interpreted script and the other is in compiled class I can use 'evaluate', but I need reuse of a function, which has return value. I tried "evaluate" of functions definitions and it seems to be not working. Can you recommend some approach of "include" of functions definitions in a script?

Required context class hudson.FilePath is missing Perhaps you forgot to surroundsuch ..as: node on Jenkins Pipeline

…衆ロ難τιáo~ 提交于 2020-02-23 07:47:10
问题 Error Message [Pipeline] Start of Pipeline [Pipeline] sh [Pipeline] End of Pipeline org.jenkinsci.plugins.workflow.steps.MissingContextVariableException: Required context class hudson.FilePath is missing Perhaps you forgot to surround the code with a step that provides this, such as: node My file Android SDK path on my Mac /Users/bhanukaisuru/Library/Android/sdk I also download android sdk tool only. Path is: /Users/bhanukaisuru/Library Environment Variable Config Jenkins > Configure System

Required context class hudson.FilePath is missing Perhaps you forgot to surroundsuch ..as: node on Jenkins Pipeline

泪湿孤枕 提交于 2020-02-23 07:47:09
问题 Error Message [Pipeline] Start of Pipeline [Pipeline] sh [Pipeline] End of Pipeline org.jenkinsci.plugins.workflow.steps.MissingContextVariableException: Required context class hudson.FilePath is missing Perhaps you forgot to surround the code with a step that provides this, such as: node My file Android SDK path on my Mac /Users/bhanukaisuru/Library/Android/sdk I also download android sdk tool only. Path is: /Users/bhanukaisuru/Library Environment Variable Config Jenkins > Configure System

How to partially mock service in Grails integration test

假如想象 提交于 2020-02-23 06:55:30
问题 I am attempting to write a test for a controller which calls a service method. I would like to mock a dependent method within that service. My spec is as follows: MyController myController = new MyController() def mockMyService def "My spy should be called"() { when: mockMyService = Spy(MyService) { methodToSpy() >> { println "methodToSpy called" } // stub out content of this fn } myController.myService = mockMyService myController.callService() then: 1 * mockMyService.methodToSpy() } When I

How does Gradle generate a new task from a task rules

一个人想着一个人 提交于 2020-02-23 06:37:10
问题 In section 19.11. of the 4.2.1 user guide is this task rule example. How is the if predicate able to be true before the rule is even executed. I also noticed that when task groupPing is entered before the task rule the build fails. How are the tasks pingServer1, pingServer2 already created before the rule even starts? tasks.addRule("Pattern: ping<ID>") { String taskName -> if (taskName.startsWith("ping")) { task(taskName) { doLast { println "Pinging: " + (taskName - 'ping') } } } } task

groovy.json.JsonException: expecting '}' or ',' but got current char

巧了我就是萌 提交于 2020-02-22 14:29:48
问题 I am trying to get a piece of code working for me and not having much luck. So I have broken the code down to this little snippet that is causing me grief. Can anyone help identify why in the world this error is happening? import groovy.json.JsonSlurper; String index = '[{accessCode=d20in9t, createdAt=2016-09-22T18:27:47.904Z, id=22cbf7c2-5d4e-4afe-a385-ddefb6e6dcf0, licenseType=mobileAppLicensesWithDevice, name=Lead Retrieval - Device Rental & App license, owner={entityType=exhibitor, id

groovy.json.JsonException: expecting '}' or ',' but got current char

為{幸葍}努か 提交于 2020-02-22 14:29:37
问题 I am trying to get a piece of code working for me and not having much luck. So I have broken the code down to this little snippet that is causing me grief. Can anyone help identify why in the world this error is happening? import groovy.json.JsonSlurper; String index = '[{accessCode=d20in9t, createdAt=2016-09-22T18:27:47.904Z, id=22cbf7c2-5d4e-4afe-a385-ddefb6e6dcf0, licenseType=mobileAppLicensesWithDevice, name=Lead Retrieval - Device Rental & App license, owner={entityType=exhibitor, id

How to upgrade FontAwesome to version 5 in JavaFX

岁酱吖の 提交于 2020-02-21 05:06:55
问题 I have a JavaFX using FontAwesome icons and I wanted to use the new version 5. But it seems it doesn't work anymore. Here's a simple demo app written in Groovy that works with the older FontAwesome version: import javafx.application.Application import javafx.scene.Scene import javafx.scene.control.Label import javafx.scene.layout.VBox import javafx.scene.text.Font import javafx.stage.Stage class App extends Application { static final String PENCIL = "\uf040" @Override void start(Stage

How to upgrade FontAwesome to version 5 in JavaFX

六月ゝ 毕业季﹏ 提交于 2020-02-21 05:04:06
问题 I have a JavaFX using FontAwesome icons and I wanted to use the new version 5. But it seems it doesn't work anymore. Here's a simple demo app written in Groovy that works with the older FontAwesome version: import javafx.application.Application import javafx.scene.Scene import javafx.scene.control.Label import javafx.scene.layout.VBox import javafx.scene.text.Font import javafx.stage.Stage class App extends Application { static final String PENCIL = "\uf040" @Override void start(Stage

How to upgrade FontAwesome to version 5 in JavaFX

◇◆丶佛笑我妖孽 提交于 2020-02-21 05:03:50
问题 I have a JavaFX using FontAwesome icons and I wanted to use the new version 5. But it seems it doesn't work anymore. Here's a simple demo app written in Groovy that works with the older FontAwesome version: import javafx.application.Application import javafx.scene.Scene import javafx.scene.control.Label import javafx.scene.layout.VBox import javafx.scene.text.Font import javafx.stage.Stage class App extends Application { static final String PENCIL = "\uf040" @Override void start(Stage