Search code examples
grailsgroovydependenciesmicronaut

How to add or import grails dependencies in micronaut


runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.8.2"

Unable to add the above mentioned grails dependency into micronaut application.

It shows the following error :

Could not determine the dependencies of task ':shadowJar'.
 > Could not resolve all dependencies for configuration ':runtimeClasspath'.
   > Could not find com.bertramlabs.plugins:asset-pipeline-grails:2.8.2.
     Required by:
         project : > sharedresourcesplugin:sharedresourcesplugin:6.0

Dependencies list is shown

dependencies {
    testCompile "org.grails:grails-plugin-testing"
    testCompile "org.grails:grails-web-testing-support"
    testCompile "org.grails.plugins:hibernate5"
    testCompile "org.hibernate:hibernate-core:5.1.5.Final"
    testCompile "org.grails:grails-gorm-testing-support"

    compile "io.micronaut.configuration:micronaut-jdbc-tomcat"
    compile "io.micronaut.configuration:micronaut-hibernate-validator"
    compile "io.micronaut.configuration:micronaut-hibernate-gorm"
    compile "org.grails:grails-datastore-gorm-hibernate5:$gormVersion"

    compile "io.micronaut:micronaut-http-client"
    compile "io.micronaut:micronaut-http-server-netty"
    compile "io.micronaut:micronaut-runtime-groovy"
    compile "io.micronaut:micronaut-validation"
    compile "javax.annotation:javax.annotation-api"
    compileOnly "io.micronaut:micronaut-inject-groovy"
    runtime "ch.qos.logback:logback-classic:1.2.3"
    runtime "com.h2database:h2"
    runtime "org.apache.tomcat:tomcat-jdbc"
    testCompile "io.micronaut:micronaut-inject-groovy"
    testCompile("org.spockframework:spock-core") {
        exclude group: "org.codehaus.groovy", module: "groovy-all"
    }

    runtime "org.hibernate:hibernate-ehcache:5.1.9.Final"
    runtime group: 'mysql', name: 'mysql-connector-java', version: '8.0.13'
    testCompile "io.micronaut:micronaut-inject-java"
    testCompile "org.hamcrest:hamcrest-all:1.3"

    runtime group: 'com.bertramlabs.plugins', name: 'assest-pipeline-grails', version: '2.8.2'
    compile group: 'sharedresourcesplugin', name: 'sharedresourcesplugin', version: '6.0'
}

Even though the dependency is added in gradle.build but still its showing the same error.


Solution

  • You'll need to include the asset-pipeline gradle plugin and then use the asset-pipeline micronaut dependency

    plugins {
        id "com.bertramlabs.asset-pipeline" version "3.0.8"
    }
    
    dependencies {
      runtime 'com.bertramlabs.plugins:asset-pipeline-micronaut:3.0.8'
      //Example LESS or Sass Integration
      //assets 'com.bertramlabs.plugins:less-asset-pipeline:3.0.8'
      //assets 'com.bertramlabs.plugins:sass-asset-pipeline:3.0.8'
    }
    

    More info here: http://www.asset-pipeline.com/manual/#getting-started-4