My Compose project was working, until I added this in build.gradle:
implementation 'androidx.lifecycle:lifecycle-runtime-compose:2.6.0-alpha05'
I am getting many build errors like this:
Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in
modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0)
and kotlin-stdlib-jdk8-1.7.0
(org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.0)
I am also using these dependencies:
implementation 'androidx.core:core-ktx:1.9.0'
Lifecycle versions: 2.5.1
Using latest versions for for Hilt, navigation
Using:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
For Gradle plugin:
id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
Any ideas?
Related
I am trying to get git commit details as part of "/actuator/info" api end point using the gradle-git-properties plugin by following https://guides.grails.org/adding-commit-info/guide/index.html guide but having no luck with it. Steps I followed:
"sdk install grails 4.0.8" //installing latest grails 4 version using sdkman
"sdk use grails 4.0.8" //making sure my current shell is using latest version as well
"grails create-app myapp --profile=rest-api" //creating a dummy app
"cd myapp" //change working dir to the new app
"git init" //initializing git
As per the guide I updated the build.gradle
buildscript {
repositories {
maven { url "https://repo.grails.org/grails/core" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "org.grails.plugins:hibernate5:7.0.4"
classpath "org.grails.plugins:views-gradle:2.0.2"
classpath "gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:2.2.0"
}
}
version "0.1"
group "myapp"
apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"org.grails.plugins.views-json"
apply plugin: "com.gorylenko.gradle-git-properties"
Also updated the application.yml file to enable actuator end points
management:
endpoints:
enabled-by-default: true
run the application using ./gradlew bootRun
I see that the git.properties file is correctly generated and placed under "build/resources/main" folder within the project folder.
But when I hit "http://localhost:8080/actuator/info" in browser, all I see is:
{"app":{"grailsVersion":"4.0.8","version":"0.1","name":"myapp"}}
But no git related info.
Raised the same issue here are well: https://github.com/n0mer/gradle-git-properties/issues/161
Solution has been provided by #virtualdogbert here : https://github.com/n0mer/gradle-git-properties/issues/161#issuecomment-936544990
Basically we have to set path to the git.properties file for dev env:
environments {
development{
spring.info.git.location='file:build/resources/main/git.properties'
}
}
I am doing a migration from Grails 2.2.2 to Grails 2.5.1.While upgrading that i am facing compilation issue for
import org.codehaus.groovy.grails.commons.ApplicationHolder
class which is present inside
spring-security-core-1.2.7.3\src\groovy\org\codehaus\groovy\grails\plugins\springsecurity\ReflectionUtils.groovy
I am using spring-security-core 1.2.7.3 and spring security ldap 1.0.6 version inside my plugin dependency tag inside the buildConfig.groovy. I tried to update the version but i am not finding the right combination for both the jars.
Could someone help me to find the correct version of both the jars which is compatible with 2.5.1 Grails.
Use compile ":spring-security-core:2.0.0" for the core plugin and compile ":spring-security-ldap:2.0.1" for the LDAP plugin.
Your BuildConfig.groovy should look like this:
grails.servlet.version = '3.0'
grails.project.work.dir = 'target'
grails.project.target.level = 1.7
grails.project.source.level = 1.7
grails.project.dependency.resolver = 'maven'
grails.project.dependency.resolution = {
inherits 'global'
log 'warn'
checksums true
legacyResolve false
repositories {
inherits true
mavenLocal()
grailsCentral()
mavenCentral()
}
dependencies {
...
}
plugins {
compile ':spring-security-core:2.0.0'
compile ':spring-security-ldap:2.0.1'
// other plugins
}
}
I am trying to use the gradle-grails-plugin to build an existing (small) Grails project. Should this work? What is the relationship between the dependencies in build.gradle and the ones specified in buildConfig.groovy?
In any event, I have two projects, so the topmost build.gradle file is in the parent directory and looks like:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "org.grails:grails-gradle-plugin:2.2.0.RC1"
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
and then the build.gradle in the Grails project looks like:
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 run ./gradlew war, I get back:
Caused by: java.long.ClassNotFoundException: grails.artefact.Service
Can anyone shed some light on this? There are practically no references to that via Google, it seems to be a Grails 3.x class? Also, I am using Java 1.7.
Class grails.artefact.Service is indeed accessible from v3.0 of grails framework - as can be seen here.
With the following statement grailsVersion = '2.4.4' v2.4.4 is specified to be used and it all looks ok. What spoils the build is the following dependencies entry:
compile 'org.grails.plugins:asset-pipeline:3.0.1'
In this package there is a class asset/pipeline/grails/AssetProcessorService that imports the mentioned grails.artefact.Service which isn't loaded at runtime (probably because of v2.4.4 used).
Unfortunately I can't suggest any solution apart from the trivial like excluding this dependency. I am not a grails developer nor have I set the environment up.
Hopes that helps somehow.
I created a simple hello world grails app using Grails 1.3.7:
grails create-app hello
grails create-controller hello
Then I try to install the spock plugin using:
grails install-plugin spock
And I get the following:
Error loading event script from file [/Users/wholladay/.grails/1.3.7/projects/hello/plugins/spock-0.6/scripts/_Events.groovy] startup failed:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/Users/wholladay/.ivy2/cache/org.spockframework/spock-core/jars/spock-core-0.6-groovy-1.8.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation because of exception org.spockframework.util.IncompatibleGroovyVersionException: The Spock compiler plugin cannot execute because Spock 0.6.0-groovy-1.8 is not compatible with Groovy 1.7.8. For more information, see http://versioninfo.spockframework.org
Spock location: file:/Users/wholladay/.ivy2/cache/org.spockframework/spock-core/jars/spock-core-0.6-groovy-1.8.jar
Groovy location: file:/usr/local/Cellar/grails/current/lib/groovy-all-1.7.8.jar
So I went to: http://versioninfo.spockframework.org and noticed that there is a version 0.6-groovy-1.7 of spock. So I tried:
grails install-plugin spock 0.6-groovy-1.7
But then I got the following error:
Error resolving plugin [name:spock, group:org.grails.plugins, version:0.6-groovy-1.7].
Plugin not found for name [spock] and version [0.6-groovy-1.7]
Any ideas?
Have you tried using the dependency resolution install instructions on the plugin page?
In your BuildConfig.groovy:
grails.project.dependency.resolution = {
repositories {
grailsCentral()
mavenCentral()
}
dependencies {
test "org.spockframework:spock-grails-support:0.6-groovy-1.7"
}
plugins {
test(":spock:0.6") {
exclude "spock-grails-support"
}
}
}
I think you've made simple mistake. What you want is:
grails install-plugin spock 0.6-groovy-1.7
I'm trying to build a Grails 2.0 application using private plugins:
mycompany-frontend = Grails Application
mycompany-core = Grails plugins for domain classes
In the mycompany-core plugin, I created some domain classe and added a joda-time dependency in BuildConfig.groovy:
plugins {
build(":tomcat:$grailsVersion",
":release:1.0.1",
":svn:1.0.2") {
export = false
}
build(":joda-time:1.3.1")
}
in the mycompany-frontend app, I have the following BuildConfig.groovy:
plugins {
runtime ":hibernate:$grailsVersion"
runtime ":resources:1.1.5"
build "mycompany:mycompany-core:0.1-SNAPSHOT"
build ":svn:1.0.2"
build ":spring-security-core:1.2.7"
build ":tomcat:$grailsVersion"
}
I also removed grails.plugins entries from application.properties to avoid confusion.
But at the end, the mycompany-frontend cannot find the model classes from mycompany-core plugin.
What should I look/fix to get this working?
Have you tried to define the dependency to your core-plugin as runtime-/compile-dependency instead of build?