Can't load resources in a gradle project - jenkins

I am using gradle 4.10.2 & IntelliJ IDEA Community Edition 2018.2
Note that this is a jenkins shared library project, hence, deviates from the standard gradle project structure.
The project shown in the image is an existing Gradle project. I am simply trying to load a properties file viz. mailTemplate.properties in a Groovy class EmailTemplate but the problem is that irrespective of where I keep it(like shown in the image), it's not loaded. I created a separate test gradle project and placed it in the default (src/main/resources) dir. and it works like a breeze.
I tried creating 'resources' at two places but in vain.
The build.gradle is:
buildscript {
repositories {
ivy {
url "$repositoryURL/$resolveRepository"
}
maven {
url "$repositoryURL/$resolveRepository"
}
}
dependencies {
classpath "tools.gradle.plugin:ReleasePlugin:1.10.0"
classpath "tools.gradle.plugin:qualityreport:v1.14.4"
}
}
group 'tools'
apply plugin: 'groovy'
apply plugin: 'tools.gradle.plugin.releaseplugin'
apply plugin: 'tools.gradle.plugin.qualityreport'
sourceSets {
main {
groovy {
srcDirs = ['src']
}
}
test {
groovy {
srcDirs = ['test/groovy']
}
}
}
repositories {
addAll(buildscript.repositories)
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.15'
compile 'org.codehaus.groovy:groovy-json:2.4.9'
compile 'com.cloudbees:groovy-cps:1.1'
compile 'org.slf4j:slf4j-api:1.7.21'
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-core:1.3'
testCompile 'net.bytebuddy:byte-buddy:1.6.4'
testCompile ('org.spockframework:spock-core:1.1-groovy-2.4') {
exclude group: 'org.codehaus.groovy'
}
testCompile gradleTestKit()
testCompile group: 'com.lesfurets', name: 'jenkins-pipeline-unit', version: '1.1'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.23.4'
testCompile group: 'tools.gradle.plugin', name: 'jenkins-shared-stages', version: 'v2.48.0'
// jenkins dependencies
testCompile 'org.jenkins-ci.plugins:script-security:1.34#jar'
}
task copySharedLibs(type: Copy, group: "PipelineTest") {
from '.'
into 'build/libs/jenkins-shared-pipelines#master'
include 'src/**'
include 'vars/**'
}
test.dependsOn(copySharedLibs)

Gradle groovy plugin expects resources to be at src/main/resources by default. In case the resources are located some other folder then it should be configured in the sourceSets. You can try the below assuming your resource file are also withing your src folder.
sourceSets {
main {
groovy {
srcDirs = ['src']
}
resources {
srcDirs = ['src']
}
}
test {
groovy {
srcDirs = ['test/groovy']
}
resources {
srcDirs = ['test/groovy']
}
}
}

Related

Adding jcenter() in rootlevel repositories breaks my build

I have a project with a Gradle buildscript and I added the bmuschko/gradle-docker-plugin to create and push image on new builds.
However I cant use the plugin if I don't specify jcenter() in root level repositories, but that breaks my build, so im kinda lost.
If I add the root level jcenter() it fails the build with:
Could not resolve all dependencies for configuration ':compileClasspath'.
Could not find com.sleepycat:je:7.0.6. Searched in the following locations:
https://jcenter.bintray.com/com/sleepycat/je/7.0.6/je-7.0.6.pom
https://jcenter.bintray.com/com/sleepycat/je/7.0.6/je-7.0.6.jar
https://repo1.maven.org/maven2/com/sleepycat/je/7.0.6/je-7.0.6.pom
https://repo1.maven.org/maven2/com/sleepycat/je/7.0.6/je-7.0.6.jar
https://nexus.company.com/content/groups/public/com/sleepycat/je/7.0.6/je-7.0.6.pom
https://nexus.company.com/content/groups/public/com/sleepycat/je/7.0.6/je-7.0.6.jar
Required by: project : > org.jpos:jpos:2.1.1
However if I don't add it i get this:
Could not resolve all dependencies for configuration ':dockerJava'.
Could not find com.aries:docker-java-shaded:3.1.0-rc-3. Searched in the following locations:
https://nexus.company.com/content/groups/public/com/aries/docker-java-shaded/3.1.0-rc-3/docker-java-shaded-3.1.0-rc-3.pom
https://nexus.company.com/content/groups/public/com/aries/docker-java-shaded/3.1.0-rc-3/docker-java-shaded-3.1.0-rc-3-cglib.jar
Required by: project :
Should I perhaps build Java shaded and include in our local Maven repo?
Here is the script:
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url = 'https://nexus.company.com/content/repositories/snapshots/'
credentials {
username 'na'
password 'na'
}
}
}
dependencies {
classpath group: 'com.company.gradle', name: 'cpmgradle', version: '0.1-SNAPSHOT'
classpath 'com.bmuschko:gradle-docker-plugin:3.4.4'
}
}
// ADDING THIS BREAKS MY BUILD BUT IS NECESSARY FOR DOCKER PLUGIN TO WORK
repositories {
jcenter()
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'com.company.gradle.java'
apply plugin: 'com.bmuschko.docker-remote-api'
projectinfo {
group = 'com.company.mesb'
artifact = 'MESB'
version = '1.29.DEV-SNAPSHOT'
description = 'MESB'
packaging = 'jar'
}
dependencies {
compile 'org.jpos:jpos:2.1.1'
compile 'org.jdom:jdom2:2.0.6'
compile 'org.json:json:20140107'
compile 'com.company.javasdk:JavaSDK:1.1.JDOM2-SNAPSHOT'
compile 'com.company.javasdk:Base64:1.0'
compile 'org.apache.wss4j:wss4j-ws-security-dom:2.0.3'
compile 'org.apache.santuario:xmlsec:2.0.3'
compile 'org.slf4j:slf4j-log4j12:1.7.10'
compile 'com.google.code.gson:gson:2.3.1'
compile 'org.bouncycastle:bcprov-jdk15on:1.54'
compile 'org.bouncycastle:bcpkix-jdk15on:1.54'
compile 'junit:junit:4.12'
compile 'org.jsoup:jsoup:1.9.2'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.ibm:mq:5.3.07'
compile 'com.ibm:mq.pcf:5.3.07'
compile 'com.ibm:mq.jmqi:5.3.07'
compile 'com.ibm:mq.headers:5.3.07'
compile 'com.ibm:mq.commonservices:5.3.07'
compile 'com.ibm:connector:1.0.0'
runtime 'jaxen:jaxen:1.1.6'
runtime 'xalan:xalan:2.7.2'
runtime 'org.postgresql:postgresql:8.0-311.jdbc3'
runtime 'commons-logging:commons-logging:1.2'
}
compileJava {
sourceCompatibility = 1.6
targetCompatibility = 1.6
options.fork = true
options.compilerArgs << '-XDignore.symbol.file'
options.forkOptions.executable = 'javac'
}
task libs(type: Copy) {
description = "Copies dependencies to the 'lib' directory of the deployment."
def libsDir = new File("$buildDir", 'libs')
libsDir.mkdirs()
def dockerDir = new File("$buildDir", 'docker')
dockerDir.mkdirs()
from project.configurations.runtime
into libsDir
}
task bundleZip(type: Zip) {
from projectDir
include 'xsl/**'
include 'conf/**'
include 'js/**'
include 'test/**'
include 'mesb.sh'
from(tasks.libs.outputs) {
include 'MESB*'
}
into project.projectinfo.version
}
tasks.bundleZip.dependsOn jar
tasks.bundleZip.dependsOn libs
def dockerUsername = project.properties['dockerUsername'] ?: ""
def dockerPassword = project.properties['dockerPassword'] ?: ""
docker {
registryCredentials {
username = dockerUsername
password = dockerPassword
}
}
task buildImage(type: com.bmuschko.gradle.docker.tasks.image.DockerBuildImage) {
doFirst {
copy {
from "${buildDir}/libs/MESB-${projectinfo.version}.jar"
into "${buildDir}/docker"
rename { String fileName ->
fileName.replace("-${projectinfo.version}", "")
}
}
copy {
from "docker/jdk/Dockerfile"
into "${buildDir}/docker"
}
copy {
from "xsl"
into "${buildDir}/docker/xsl"
}
copy {
from "conf"
into "${buildDir}/docker/conf"
}
copy {
from "test"
into "${buildDir}/docker/test"
}
copy {
from "${buildDir}/libs"
into "${buildDir}/docker/libs"
}
}
inputDir = project.file("${buildDir}/docker")
tag = "company/mesb:${projectinfo.version}"
}
tasks.buildImage.dependsOn build
task pushImage(type: com.bmuschko.gradle.docker.tasks.image.DockerPushImage) {
imageName = "company/mesb"
tag = "${projectinfo.version}"
}
tasks.pushImage.dependsOn buildImage
artifacts {
archives bundleZip
}
/* Remove the default JAR file from the uploaded artifacts */
configurations.archives.artifacts.with { archives ->
def jarArtifact
archives.each {
if (it.file =~ 'jar') {
jarArtifact = it
}
}
remove(jarArtifact)
}
jar {
dependsOn configurations.runtime
manifest {
attributes 'Main-Class': 'main.MESB'
}
}
tasks.build.dependsOn libs
sourceSets {
main {
java {
srcDir 'src'
}
}
}
Apparently moving root repository definitions benieth the apply plugins section solved this.
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'com.company.gradle.java'
apply plugin: 'com.bmuschko.docker-remote-api'
repositories {
jcenter()
mavenCentral()
}
Don't know whether you have solved your issue but either way...
I encountered a similar issue regarding:
Could not resolve all dependencies for configuration ':dockerJava'.
Could not find com.aries:docker-java-shaded:3.1.0-rc-3.
We solved it by adding the following
repositories {
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}

Implementation project Android Studio 3.0

android studio multiple modules project
Where can the problem be?
Error Messages Print Screen -
project build.gradle
buildscript { repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app build.gradle
...
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation project(':t2')
}
Setting gradle
include ':app', ':t2'
This problem has been fixed with the new versions of Gradle(v3.3.0) and AndroidStudio(v3.3).

DebuggingClassWriter overrides final method visit

I have a grails 3 project where I had to write a regular Spring MVC #RestfulController (for Chunk json response reasons). Anyway I tried to write a simple Spock unit test for the simple controller actions. They run fine inside IDEA but out on the command line they fail with strange errors related to asm/cglib from what i have read. Anyone know how I can get around this ?
Test the advanced search action returns a page of results
java.lang.NoClassDefFoundError: Could not initialize class org.spockframework.mock.runtime.ProxyBasedMockFactory$CglibMockFactory$ConstructorFriendlyEnhancer
at org.spockframework.mock.runtime.ProxyBasedMockFactory$CglibMockFactory.createMock(ProxyBasedMockFactory.java:80)
at org.spockframework.mock.runtime.ProxyBasedMockFactory.create(ProxyBasedMockFactory.java:49)
at org.spockframework.mock.runtime.JavaMockFactory.create(JavaMockFactory.java:51)
at org.spockframework.mock.runtime.CompositeMockFactory.create(CompositeMockFactory.java:44)
at org.spockframework.lang.SpecInternals.createMock(SpecInternals.java:45)
at org.spockframework.lang.SpecInternals.createMockImpl(SpecInternals.java:281)
at org.spockframework.lang.SpecInternals.MockImpl(SpecInternals.java:83)
at uk.ac.xxx.coursefinder.controller.SearchControllerSpec.setup(SearchControllerSpec.groovy:27)
Test the basic search action returns a page of results
java.lang.VerifyError: class net.sf.cglib.core.DebuggingClassWriter overrides final method visit.(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at net.sf.cglib.core.AbstractClassGenerator.<init>(AbstractClassGenerator.java:38)
at net.sf.cglib.core.KeyFactory$Generator.<init>(KeyFactory.java:127)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:112)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
at org.spockframework.mock.runtime.ProxyBasedMockFactory$CglibMockFactory.createMock(ProxyBasedMockFactory.java:80)
at org.spockframework.mock.runtime.ProxyBasedMockFactory.create(ProxyBasedMockFactory.java:49)
at org.spockframework.mock.runtime.JavaMockFactory.create(JavaMockFactory.java:51)
at org.spockframework.mock.runtime.CompositeMockFactory.create(CompositeMockFactory.java:44)
at org.spockframework.lang.SpecInternals.createMock(SpecInternals.java:45)
at org.spockframework.lang.SpecInternals.createMockImpl(SpecInternals.java:281)
at org.spockframework.lang.SpecInternals.MockImpl(SpecInternals.java:83)
at uk.ac.xxx.coursefinder.controller.SearchControllerSpec.setup(SearchControllerSpec.groovy:27)
Here is my test:
package uk.ac.xxx.coursefinder.controller
import org.springframework.data.domain.Page
import org.springframework.data.domain.PageImpl
import org.springframework.data.domain.PageRequest
import spock.lang.Specification
import uk.ac.xxx.coursefinder.command.AdvancedSearchCommand
import uk.ac.xxx.coursefinder.command.BasicSearchCommand
import uk.ac.xxx.coursefinder.search.SearchService
import uk.ac.xxx.coursefinder.solr.domain.CourseGuide
/**
* Pure unit test
*/
class SearchControllerSpec extends Specification {
SearchController searchController = new SearchController()
SearchService searchService
def setup() {
searchService = Mock()
searchController.searchService = searchService
}
def cleanup() {
}
def "Test the basic search action returns a page of results"() {
given:
print "1"
Page expectedPage = new PageImpl<CourseGuide>([new CourseGuide()])
BasicSearchCommand basicSearchCommand = new BasicSearchCommand()
PageRequest pageRequest = new PageRequest(0, 20)
when: "The basic search action is executed with a BasicSearchCommand"
Page page = searchController.basic(basicSearchCommand, pageRequest)
then: "The correct search service was called with the appropriate arguments and returned expected results"
1 * searchService.basic(basicSearchCommand, pageRequest) >> expectedPage
page == expectedPage
}
def "Test the advanced search action returns a page of results"() {
given:
print "2"
Page expectedPage = new PageImpl<CourseGuide>([new CourseGuide()])
AdvancedSearchCommand advancedSearchCommand = new AdvancedSearchCommand()
PageRequest pageRequest = new PageRequest(0, 20)
when: "The advanced search action is executed with a AdvancedSearchCommand"
Page page = searchController.advanced(advancedSearchCommand, pageRequest)
then: "The correct search service was called with the appropriate arguments and returned expected results"
1 * searchService.advanced(advancedSearchCommand, pageRequest) >> expectedPage
page == expectedPage
}
}
and my build.gradle file:
buildscript {
ext {
grailsVersion = project.grailsVersion
}
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.6.4"
classpath "gradle.plugin.com.craigburke.gradle:karma-gradle:1.4.3"
classpath "gradle.plugin.com.craigburke.gradle:bower-installer-gradle:2.5.1"
classpath "org.grails.plugins:hibernate4:5.0.2"
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.5.0"
classpath "org.grails.plugins:views-gradle:1.0.4"
classpath "net.saliman:gradle-cobertura-plugin:2.3.1"
}
}
version "0.1"
group "coursefinder.grails.angular"
apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"org.grails.grails-gsp"
apply plugin:"com.craigburke.karma"
apply plugin:"com.craigburke.bower-installer"
apply plugin:"asset-pipeline"
apply plugin:"org.grails.plugins.views-json"
apply plugin:"net.saliman.cobertura"
ext {
grailsVersion = project.grailsVersion
gradleWrapperVersion = project.gradleWrapperVersion
}
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
maven { url "http://maven.restlet.org" } //needed for solr core lib
}
dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
}
applyMavenExclusions false
}
dependencies {
assets "com.craigburke.angular:angular-template-asset-pipeline:2.2.6"
assets "com.craigburke.angular:angular-annotate-asset-pipeline:2.4.0"
assets "com.craigburke:js-closure-wrap-asset-pipeline:1.2.0"
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-plugin-url-mappings"
compile "org.grails:grails-plugin-rest"
compile "org.grails:grails-plugin-codecs"
compile "org.grails:grails-plugin-interceptors"
compile "org.grails:grails-plugin-services"
compile "org.grails:grails-plugin-datasource"
compile "org.grails:grails-plugin-databinding"
compile "org.grails:grails-plugin-async"
compile "org.grails:grails-web-boot"
compile "org.grails:grails-logging"
compile "org.grails.plugins:cache"
compile "org.grails:grails-plugin-gsp"
compile "org.grails.plugins:hibernate4"
compile "org.hibernate:hibernate-ehcache"
compile "org.grails.plugins:views-json"
console "org.grails:grails-console"
//solr and rest stuff
compile('org.springframework.boot:spring-boot-starter-data-rest')
compile('org.springframework.boot:spring-boot-starter-data-solr')
//for embedded server
compile ('org.apache.solr:solr-core:4.10.4') {
exclude(group: "org.slf4j", module: "slf4j-jdk14")
exclude(group: "ch.qos.logback", module: "logback-classic")
}
compile "org.grails.plugins:grails3-cas-client:3.0"
compile "org.ccil.cowan.tagsoup:tagsoup:1.2"
profile "org.grails.profiles:angular:3.1.3"
runtime "com.h2database:h2"
runtime "org.grails.plugins:asset-pipeline"
testCompile "org.grails:grails-plugin-testing"
//testCompile "org.grails.plugins:geb"
testCompile "org.grails:grails-datastore-rest-client"
//testCompile 'org.mockito:mockito-all:1.10.19'
//testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
//testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
runtime 'org.grails.plugins:grails-console:2.0.4'
//testRuntime "org.slf4j:slf4j-api:1.7.10" //stop cobertura class not found exception
}
task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}
bower {
'angular'('1.4.x') {
source 'angular.js'
}
'angular-resource'('1.4.x') {
source 'angular-resource.js' >> '/angular/'
}
'angular-route'('1.4.x') {
source 'angular-route.js' >> '/angular/'
}
'angular-mocks'('1.4.x') {
source 'angular-mocks.js' >> '/angular/'
}
'angular-bootstrap'('1.1.x') {
source 'ui-bootstrap-tpls.js' >> '/angular/'
}
'bootstrap'('3.x.x') {
source 'dist/css/bootstrap.css' >> '/bootstrap/'
}
}
karma {
dependencies(['karma-wrap-preprocessor'])
profile 'angularJS'
preprocessors = [
'grails-app/assets/javascripts/**/*.js': ['wrap']
]
wrapPreprocessor = [
template: "(function () { 'use strict'; <%= contents %> })()"
]
}
assets {
minifyJs = true
minifyCss = true
}
I just had a similar problem.
It seems that the cglib:cglib-nodep:2.2.2 lib needs to be available at compile time. It is pulled in by the org.grails:grails-plugin-testing plugin.
I was able to solve it in two ways; both involving the dependencies {...} block in build.gradle:
1) Add compile 'cglib:cglib-nodep:2.2.2'
Or
2) Changing testCompile "org.grails:grails-plugin-testing" to compile "org.grails:grails-plugin-testing"
Hope it helps.

Building uberjar with gradle fails in jenkins

Hi I'm using gradle to create a fat jar.
It works properly on my local machine but fails when running from Jenkins.
My local gradle version is: GradleVersion.current().getVersion()=2.2.1
The one in Jenkins: GradleVersion.current().getVersion()=2.4
build.gradle looks like
Is there anything about gradle version?
I just run tasks: clean uberjar
apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
sourceCompatibility = 1.5
version = '1.0'
repositories {
mavenLocal()
mavenCentral()
}
def classifier = 'producao'
println "GradleVersion.current().getVersion()="+ GradleVersion.current().getVersion()
println "Project env = '${project.hasProperty('env')}'"
// para passar parametros -Penv=homologacao
if (project.hasProperty('env') && project.getProperty('env') == 'homologacao') {
classifier = 'homologacao'
}
println "Classifier = ${classifier}"
println "Using 'com.mundi:OneStop:1.0:${classifier}'"
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.10'
compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
compile 'net.sf.opencsv:opencsv:2.3'
compile "com.mundi:OneStop:1.0:${classifier}"
compile 'org.apache.commons:commons-lang3:3.4'
testCompile group: 'junit', name: 'junit', version: '4.+'
testCompile "org.spockframework:spock-core:1.0-groovy-2.3"
}
task listJars << {
configurations.compile.each { File file -> println file.name }
}
test { systemProperties 'property': 'value' }
uploadArchives {
repositories { flatDir { dirs 'repos'
} }
}
task copyToLib(type: Copy) {
into "build/classes/main"
sourceSets {
main { resources { srcDir 'src/main/resources' } }
}
from sourceSets.main.resources
}
task uberjar(type: Jar, group:'Extra Jars', description: 'Assembles a single uber jar archive containing the main classes along with all its dependencies.',
dependsOn:[':copyToLib',
':compileJava',
':compileGroovy',
':processResources'
]) {
classifier = 'uber'
destinationDir new File("$buildDir")
from files(sourceSets.main.output.classesDir)
from(configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) }) {
//exclude all META-INF that may appear in any dependant jar
exclude "META-INF/**"
}
version = '1.0'
baseName = "OneStopMonitor"
manifest {
attributes 'Main-Class': "com.onestop.monitor.AirMonitor",
'Implementation-Title': 'OneStop Monitor',
'Implementation-Version': version
}
}
group = 'com.onestop'
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file:///Users/eduardorodrigues/.m2/repository")
}
}
}

Grails 3 asset-pipeline / coffee-asset pipeline

I am using asset-pipeline to manage my front end resources for my Grails 3.0 application. However it seems that source-maps for CoffeeScript files are not created. Is there any way to enable this?
My build.gradle is as follows:
buildscript {
ext {
grailsVersion = project.grailsVersion
}
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath 'com.bertramlabs.plugins:asset-pipeline-gradle:2.6.2'
classpath 'com.bertramlabs.plugins:coffee-asset-pipeline:2.6.2'
classpath "org.grails.plugins:hibernate:4.3.10.5"
}
}
plugins {
id "io.spring.dependency-management" version "0.5.2.RELEASE"
}
version "0.1"
group "grails2"
apply plugin: "spring-boot"
apply plugin: "war"
apply plugin: "asset-pipeline"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "org.grails.grails-web"
apply plugin: "org.grails.grails-gsp"
ext {
grailsVersion = project.grailsVersion
gradleWrapperVersion = project.gradleWrapperVersion
}
assets {
minifyJs = true
minifyCss = true
enableSourceMaps = true
}
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
}
applyMavenExclusions false
}
dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-dependencies"
compile "org.grails:grails-web-boot"
compile "org.grails.plugins:hibernate"
compile "org.grails.plugins:cache"
compile "org.hibernate:hibernate-ehcache"
compile "org.grails.plugins:scaffolding"
runtime "org.grails.plugins:asset-pipeline"
runtime 'com.bertramlabs.plugins:coffee-asset-pipeline:2.6.2'
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
// Note: It is recommended to update to a more robust driver (Chrome, Firefox etc.)
testRuntime 'org.seleniumhq.selenium:selenium-htmlunit-driver:2.44.0'
console "org.grails:grails-console"
}
task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}
This is my application.coffee
#= require test
#= require_tree .
#= require_self
console.log "This is my manifest"
$ ->
$("#spinner")
.ajaxStart -> $(this).fadeIn()
.ajaxStop -> $(this).fadeOut()
And have included the following tag in my main.gsp:
<asset:javascript src="application.coffee"/>
However, the source I get in the Chrome Browser Developer tools is the following:
// Generated by CoffeeScript 1.9.2
(function() {
console.log("This is my manifest");
$(function() {
return $("#spinner").ajaxStart(function() {
return $(this).fadeIn();
}).ajaxStop(function() {
return $(this).fadeOut();
});
});
}).call(this);
source, what you see, is actually coffee script "translated" into pure JS. From main page of Coffescript
"CoffeeScript is a little language that compiles into JavaScript."
(http://coffeescript.org)

Resources