I'm running
Jenkins 2.235.1
promoted-builds 3.5
JobDSL 1.77
When I do the small example as the documentation says.
properties {
promotions {
promotion {
name('build')
icon('star-silver')
condition {
selfPromotion('false')
}
}
}
}
I get the following error:
Caused by: javaposse.jobdsl.dsl.DslScriptException: (script, line 86) No signature of method: javaposse.jobdsl.dsl.helpers.properties.PropertiesContext.promotions() is applicable for argument types: (webshop_v8.script$_run_closure1$_closure7$_closure20) values: [webshop_v8.script$_run_closure1$_closure7$_closure20#265f0971]
According to the documentation, I have added it correctly, but my jobDslTest doesn't allow it. Someone that can give me a hint? I'm sort of lost atm.
The problem was in my case:
We are using the Job DSL Plugin(1) that provides tests for us, to execute them locally before pushing the commit.
This plugin was still using an old version of Jenkins, by adding a newer version to my build.gradle my problem was solved.
dependencies {
.
.
.
jobDslTestRuntime "org.jenkins-ci.main:jenkins-war:2.235.1"
}
https://github.com/AOEpeople/gradle-jenkins-job-dsl-plugin
Related
I have a DSL script that creates a new job. Part of the code looks like this:
pipelineTriggers {
triggers {
// cron('''${SCHEDULE}''')
parameterizedTimerTrigger {
parameterizedCron('''${SCHEDULE} % INSTANCE=testserver''')
}
}
}
When I run it, I got the error:
Processing provided DSL script
ERROR: (script, line 6) No signature of method: javaposse.jobdsl.dsl.jobs.WorkflowJob.pipelineTriggers() is applicable for argument types: (script$_run_closure1$_closure3) values: [script$_run_closure1$_closure3#8160ead]
Finished: FAILURE
Line 6 is the pipelineTriggers {. I can not find any info online for the particular error. The Job DSL plugin is v. 1.81.
When I tried to use cron('''${SCHEDULE}'''), I got the same error.
If I take off the pipelineTriggers { and just use the triggers, I got an warning saying triggers is deprecated.
Any idea how I can fix this issue?
Thanks!
The similar issue is reported on grails-core repository on github. But it is not answering all questions I am having and not working (partially).
Issue reported on github
Grails version: 4.0.3
Project Structure:
Main Project
+--- CommonPlugin
+--- AddonPlugin
Plugin Descriptor Snippet:
class AddonGrailsPlugin extends Plugin {
...
void doWithDynamicMethods() {
ExperimentService.metaClass.performOperation = { ExperimentCmd cmd ->
..
< METHOD_FUNCTIONALITY >
...
return < RETURN_ELEMENTS >;
}
}
...
}
And then trying to access method from CommonPlugin throws below error.
No signature of method: com.test.services.ExperimentService.performOperation() is applicable for argument types: (com.test.commands.ExperimentCmd) values: [com.test.commands.ExperimentCmd#1ab5698]
Possible solutions: performOperation(com.test.commands.ExperimentCmd)
Have followed resolution step provided on the link above and added code to plugin descriptor class.
ExperimentService.metaClass = GroovySystem.metaClassRegistry.getMetaClass(ExperimentService.getClass())
But it does not works. So followed the approach to enable ExpandoMetaClass globally and it does works perfectly.
Question:
Any plugin specific solution available to update metaClass to reflect newly added method from doWithDynamicMethods() or the only solution is to enable ExpandoMetaClass globally?
I used grails 3.1.X in NetBeans 8.1.
Secured plugin is not resolving wen a used annotation. Code below:
package securityplugintest
//import grails.plugins.springsecurity.Secured
import grails.plugin.springsecurity.annotation.Secured //not esolved
#Secured(['ROLE_USER']) //not resolved
class ProductAnnouncementController {
def index() {
def announcements = ProductAnnouncement.createCriteria().list {
order("dateCreated", "desc")
maxResults(1)
}
render announcements.first()?.message
//render announcements.any()?.meassage
}
}
In NetBeans I have configured Grails 3.1.11, and spring-security plugin as
dependencies {
compile 'org.grails.plugins:spring-security-core:3.0.3'
}
I am following this manual and getting error for the last step.
Well First thing you should add plugin compile 'org.grails.plugins:spring-security-core:3.1.1 under the build.gradle .
I have just given you the different plugin version than that of you are using nothing more.
Second thing you should compile your project after adding the plugin.
This should do the trick for you.
But as you have stated that you are getting the red line under the import grails.plugin.springsecurity.annotation.Secured after above steps.
Please follow the below step :
As stated in the Grails 3 docs ->
To use annotations, specify securityConfigType="Annotation" , or
leave it unspecified because it’s the default:
Specifying securityConfigType as “Annotation”
grails.plugin.springsecurity.securityConfigType = "Annotation"
In your case please try to specify it.
And before running the app please clean -> compile -> run your app.
Can you please change your plugin to compile 'org.grails.plugins:spring-security-core:3.1.1' and compile it once added. – Prakash Thete
I recently added database-migration-plugin to my grails 3.0.11 app. The problem is when I try to run-app I get a following error:
ERROR grails.boot.GrailsApp - Application startup failed
Exception in thread "main" org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'springLiquibase_dataSource':
Invocation of init method failed; nested exception is liquibase.exception.ChangeLogParseException:
java.lang.IllegalArgumentException: Script text to compile cannot be null!
Looks like it can't find changelog.xml in my grails-app/migrations folder. My build.gradle file contains:
buildscript {
dependencies {
classpath "org.grails.plugins:database-migration:2.0.0.RC1"
}
}
and
sourceSets {
main {
resources {
srcDir 'grails-app/migrations'
}
}
}
I also added the following lines in my application.groovy file:
grails.plugin.databasemigration.updateOnStart = true
grails.plugin.databasemigration.updateOnStartFileNames = ['changelog.xml']
I would by very gratefull for any advice how to make database-migration-plugin work properly.
Edit:
I created changelog.xml file using $grails dbm-create-changelog command
I also added to build.gradle (as suggested by $grails plugin-info database-migration command):
dependencies {
compile "org.grails.plugins:database-migration:2.0.0.RC1"
}
then I changed it to (following official documentation):
dependencies {
runtime "org.grails.plugins:database-migration:2.0.0.RC1"
}
and then (as suggested by manual for startup error) I forced liquibase:
dependencies {
compile 'org.liquibase:liquibase-core:3.3.2'
runtime 'org.grails.plugins:database-migration:2.0.0.RC1'
}
and
dependencies {
compile 'org.liquibase:liquibase-core:3.3.2'
compile 'org.grails.plugins:database-migration:2.0.0.RC1'
}
The problem still remains: java.lang.IllegalArgumentException: Script text to compile cannot be null!
We ran into the same problem when upgrading to Grails 3.
A look into the code of the grails-database-migration plugin made clear that the configuration parameter is changed from a list updateOnStartFileNames to a single value updateOnStartFileName.
So when you change your config from
grails.plugin.databasemigration.updateOnStartFileNames = ['changelog.xml']
to
grails.plugin.databasemigration.updateOnStartFileName = 'changelog.xml'
it should work again.
I ran into a similar error. In my case we had some lookup tables where we were populating using a hand crafted script which was included into the main changelog.groovy like:
include file: 'data/001-tablex-data.groovy'
except the file name was incorrect - it should have been 002-... instead. The error is basically the same, but there is no reporting to indicate which included file is not being found/parsed, which is a pain. So if you have manually included files, then look for incorrectly named ones in addition to checking the top-level changelog.groovy or changelog.xml
Ok, I finally found a solution. Maybe it will help someone someday. So what I did was simply delete changelog.groovy (i switched from XML to Groovy) file. Then I generated a new one with $grails dbm-create-changelog changelog.groovycommand. As a final step I run $grails dbm-changelog-sync and everything started to work just fine.
I was facing this issue too and in my case, the problem was the order of that block in build.gradoe
sourceSets {
main {
resources {
srcDir 'grails-app/migrations'
}
}
}
It MUST be before the bootRun, like the below code.
sourceSets {
main {
resources {
srcDir 'grails-app/migrations'
}
}
}
bootRun {
jvmArgs(
'-Dspring.output.ansi.enabled=always',
'-noverify',
'-XX:TieredStopAtLevel=1',
'-Xmx1024m')
sourceResources sourceSets.main
String springProfilesActive = 'spring.profiles.active'
systemProperty springProfilesActive, System.getProperty(springProfilesActive)
}
If you put sourceSets after bootRun your application will not find the migrations file.
Make sure:
You have set up the changelog, i.e., the file grails-app/migrations/changelog.xml exists and is valid.
How you do this depends on your situation. The plugin's documentation has a section for how to create the file initially.
Your datasource is set up to use the database that changelog.xml applies to.
Another potential cause for this problem that we had run into was incorrect capitalization. If changelog.groovy references path/someFile.groovy but the actual name is path/somefile.groovy then you will get this error. Make sure the path name capitalization matches.
I'm using Grails and want to use groovyws to call an web-service.
But my groovyws.jar (0.5.2) have MANY dependences that I can't solve.
Is there any jar with all dependences included?
Note: I tried put in BuildConfig.groovy, this
dependencies {
'org.codehaus.groovy.modules:groovyws:0.5.2'
}
but I'm getting error:
Error executing script Compile: loader constraint violation: when
resolving overridden method
"org.apache.xerces.jaxp.SAXParserImpl.getParser()Lorg/xml/sax/Parser;"
the class loader (instance of
org/codehaus/groovy/grails/cli/support/GrailsRootLoader) of the
current class, org/apache/xerces/jaxp/SAXParserImpl, and its
superclass loader (instance of ), have different Class
objects for the type org/xml/sax/Parser used in the signature
You can manually exclude xerces by:
dependencies {
runtime('org.codehaus.groovy.modules:groovyws:0.5.2') {
exclude: 'xerces'
}
}
GroovyWS pulls inn CXF, which again pulls in a lot of dependencies, some of them conflicting with classes already present in Java 6. You need to exclude all these dependencies if using Java 6, to avoid errors like the one you mention.
Here's my exclude list:
compile("org.codehaus.groovy.modules:groovyws:0.5.2") {
excludes 'geronimo-servlet_2.5_spec', 'servlet-api', 'jaxb-xjc', 'jaxb-impl', 'xml-apis', 'saaj-impl', 'junit', 'slf4j-jdk14', 'xmlParserAPIs', 'jaxb-api', 'saaj-api', 'xmlbeans', 'jaxen', 'geronimo-stax-api_1.0_spec', 'geronimo-activation_1.0.2_spec', 'abdera-client', 'geronimo-activation_1.1_spec'
}
Note that on Ubuntu you need jaxb-xjc and jaxb-impl after all, don't know why.
I found:
http://docs.codehaus.org/dosearchsite.action?queryString=groovyws+standalone
Tks a lot!
(search for "groovyws standalone")
Note: I saw this tip here.