Gradle giving a ClassNotFoundException when creating a Grails project

I am trying to use gradle -grails-plugin to create an existing (small) Grails project. Should this work? What is the relationship between the dependencies in build.gradle and those specified in buildConfig.groovy ?

In any case, I have two projects, so the topmost build.gradle file is in the parent directory and looks like this:

 buildscript { repositories { jcenter() } dependencies { classpath "org.grails:grails-gradle-plugin:2.2.0.RC1" } } task wrapper(type: Wrapper) { gradleVersion = '2.3' } 

and then build.gradle in a Grails project looks like this:

 apply plugin: "grails" repositories { grails.central() //creates a maven repo for the Grails Central repository (Core libraries and plugins) } grails { grailsVersion = '2.4.4' groovyVersion = '2.3.9' springLoadedVersion '1.2.0.RELEASE' } dependencies { bootstrap "org.grails.plugins:tomcat:7.0.55.3" compile 'org.grails.plugins:asset-pipeline:3.0.1' compile 'org.grails.plugins:scaffolding:2.1.2' compile 'org.grails.plugins:cache:1.1.8' runtime 'org.grails.plugins:hibernate4:4.3.1.1' runtime 'org.grails.plugins:database-migration:1.3.8' runtime 'org.grails.plugins:jquery:1.11.0' } 

However, when I start ./gradlew war , I return:

 Caused by: java.long.ClassNotFoundException: grails.artefact.Service 

Can anyone shed some light on this? There are almost no links to Google. Does it look like it's Grails 3.x class? In addition, I am using Java 1.7.

+6
source share
1 answer

The grails.artefact.Service class grails.artefact.Service indeed available from v3.0 of the grails framework - as you can see here .

When using the following statement, grailsVersion = '2.4.4' v2.4.4 is indicated and everything looks fine. What spoils the assembly is the following dependencies entry:

 compile 'org.grails.plugins:asset-pipeline:3.0.1' 

This package has an asset/pipeline/grails/AssetProcessorService that imports the aforementioned grails.artefact.Service , which does not load at run time (possibly due to the use of v2.4.4).

Unfortunately, I cannot offer any solution other than trivial, excluding this dependence. I am not a grails developer and am not installing an environment.

Hopes that help somehow.

+1
source

Source: https://habr.com/ru/post/985940/


All Articles