Grails 3 "Build failed with an exception" using assets-pipeline with sass-grails-asset-pipeline - grails

I'm trying to use the grails asset-pipeline plugin with the sass extension on Grails 3. Unfortunately, following the documentation to configure them in the build.gradle file isn't useful because this error is generated:
FAILURE: Build failed with an exception.
* Where:
Build file '/MyProject/build.gradle' line: 17
* What went wrong:
Could not compile build file '/MyProject/build.gradle'.
> startup failed:
build file '/MyProject/build.gradle': 17: only id(String) method calls allowed in plugins {} script block
See http://gradle.org/docs/2.3/userguide/plugins.html#sec:plugins_block for information on the plugins {} block
# line 17, column 5.
provided ":sass-asset-pipeline:$assetsPipelineSassVersion"
^
1 error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3.128 secs
| Error Error initializing classpath: startup failed:
build file '/MyProject/build.gradle': 17: only id(String) method calls allowed in plugins {} script block
See http://gradle.org/docs/2.3/userguide/plugins.html#sec:plugins_block for information on the plugins {} block
# line 17, column 5.
provided ":sass-asset-pipeline:$assetsPipelineSassVersion"
^
1 error
(Use --stacktrace to see the full trace)
0

I've found a solution with this gradle configuration (version variables are defined in gradle.properties):
buildscript {
dependencies {
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:$assetsPipelineVersion"
}
}
apply plugin: 'com.bertramlabs.asset-pipeline'
assets {
minifyJs = true
minifyCss = true
from '/img'
from '/js'
from '/css'
from '/fonts'
}
dependencies {
compile "org.grails.plugins:asset-pipeline"
runtime "org.grails.plugins:asset-pipeline"
assets "com.bertramlabs.plugins:sass-asset-pipeline:$assetsPipelineSassVersion"
}

Related

General error during semantic analysis: Unsupported class file major version 60

I am trying to execute grails help or grails create-controller Book in grails project using command prompt.
Error shown in cmd:
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\grails start\grails-crud\build.gradle'
* What went wrong:
Could not compile build file 'D:\grails start\grails-crud\build.gradle'.
> startup failed:
General error during semantic analysis: Unsupported class file major version 60

Quartz not working in Grails4, Issue in dependency not able to compile

Getting error in Scheduler Dependency i'm using grails4 :
Anyone let me know correct dependency for scheduler
dependencies {
compile "org.grails.plugins:quartz:2.0.1"
}
and also tried this:
dependencies {
compile "com.agileorbit:schwartz:1.0.1"
}
Both are not able to compile:
grails run-app
| Resolving Dependencies. Please wait...
| Running application...
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':compileGroovy'.
org/quartz/JobExecutionContext
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 10s
| Error Failed to start server (Use --stacktrace to see the full trace)
You will need to add the quartz dependency explicitly in addition to the plugin as Gradle 5 stopped pulling in transitive dependancies. Also I'd suggest using the latest version (2.0.13 vs 2.0.1 which is quite old)
buildscript {
dependencies {
classpath 'org.grails.plugins:quartz:2.0.13' // Needed to compile *Job classes
}
}
dependencies {
compile 'org.grails.plugins:quartz:2.0.13'
compile 'org.quartz-scheduler:quartz:2.2.1' // Is not pulled in by default
}
We're using quartz in grails4 applications with:
dependencies {
//...
compile("org.quartz-scheduler:quartz:2.2.3") {
exclude group: 'slf4j-api', module: 'c3p0'
}
compile ('org.grails.plugins:quartz:2.0.13')
}
here's the issue description on github: https://github.com/grails-plugins/grails-quartz/issues/107

Grails 3.2.11 plugin bintrayUpload missing grails-plugin.xml

I follow the grails 3 plugin tutorial. I create a project:
https://github.com/fabiooshiro/no-surprises
$ gradle bintrayUpload
> Configure project :
Gradle now uses separate output directories for each JVM language, but this build assumes a single directory for all classes from a source set. This behaviour has been deprecated and is scheduled to be removed in Gradle 5.0
at build_84d0cz3ffyc3w9ul7qh3qjt2t.run(/home/ivt/investtools/no-surprises/build.gradle:17)
The setTestClassesDir(File) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the setTestClassesDirs(FileCollection) method instead.
at build_84d0cz3ffyc3w9ul7qh3qjt2t.run(/home/ivt/investtools/no-surprises/build.gradle:17)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':publishMavenPublicationToMavenLocal'.
> Failed to publish publication 'maven' to repository 'mavenLocal'
> Invalid publication 'maven': artifact file does not exist: '/home/ivt/investtools/no-surprises/build/classes/java/main/META-INF/grails-plugin.xml'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED in 1s
11 actionable tasks: 2 executed, 9 up-to-date

Passing command Line Arguments for grails run-app through gradle task

I have a grails 3 application for which I am trying to pass command line arguments to my application when I am running it through gradle bootRun task.
I want to read the arguments in my config file for runtime operations. As per the grails documentation for yml configration here I tried to add the following to my build.gradle file
run {
systemProperties = System.properties
}
When I add that configuration and run my task I get the following error:
3:11:20 PM: Executing external task 'bootRun -Dcolor=red -Dfruit=apple'...
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\docs\projects\jet\build.gradle' line: 85
* What went wrong:
A problem occurred evaluating root project 'jet'.
> Could not find method run() for arguments [build_6lnm3xriwcnri1zrvfit1niuu$_run_closure8#4446881a] on root project 'jet'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 8.892 secs
Could not find method run() for arguments [build_6lnm3xriwcnri1zrvfit1niuu$_run_closure8#4446881a] on root project 'jet'.
3:11:32 PM: External task execution finished 'bootRun -Dcolor=red -Dfruit=apple'.
Please let me know if there is anything I am missing here or if there is a better way of doing this.
So I find out what the issue was.
Grails 3.0 uses bootRun as target instead of run. Changing adding the below code fixed the issue.
bootRun {
systemProperties = System.properties
}
Hope this helps everyone.

ElasticSearch plugin causing server to stop in Grails 3.1.6

I'm trying to add ElasticSearch plugin in my Grails 3.1.6 project.
I installed plugin as:
dependencies {
//..
compile 'org.grails.plugins:elasticsearch:1.0.0.2'
//..}
And configured application.yml as
elasticSearch:
client:
node: local
datastoreImpl: hibernateDatastore
But when I try to run application, i'm getting error as below:
BUILD SUCCESSFUL
Total time: 5.118 secs
|Running application...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bootRun'.
> A problem occurred starting process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe''
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error |
Failed to start server (Use --stacktrace to see the full trace)
Process finished with exit code 1
I'm using IntellijIdea v2016 as IDE.
Would someone please help me to figure out the error spot please.
Thanks.
This isn't related to the plugin, it's a Boot/Gradle problem caused by having a classpath that causes the process to fail because the combined length of the process command is larger than the max Windows allows. This was fixed in 3.1.2 but you have to add a small config setting to build.gradle since it's not a problem in Linux or OSX:
grails {
pathingJar = true
}
See https://github.com/grails/grails-core/issues/9125 for more info.

Resources