This message was deleted.
# community-support
s
This message was deleted.
v
As you already found out that you need to replace the placeholders with the actual kapt processor coordinates of course, this is not really Gradle question. Probably more a question of how to use MapStruct.
a
The problem is that I haven't added any map struct code ;/ it just stops compiling when I add these dependencies. This is why I bet it can be related to the Gradle.
Copy code
PS C:\Users\X\Desktop\freshood\freshNearMe> ./gradlew clean build
Starting a Gradle Daemon, 1 incompatible and 8 stopped Daemons could not be reused, use --status for details
> Task :modules:kaptKotlin FAILED

FAILURE: Build failed with an exception.                                                                                                                                                                                            

* What went wrong:
Execution failed for task ':modules:kaptKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
   > java.lang.reflect.InvocationTargetException (no error message)
This is Gradle multi-module project, maybe I have wrongly added the dependencies. Could you check my gradle build file? https://pastebin.com/9rMcujy9
v
You do many things wrong / bad practice there, but I bet your bet is wrong. What you showed in your SO question is, that some kapt generated code has compile errors. As you just added mapstruct as kapt processor it is highly likely that it generates something that cannot be compiled. Why it is like that has not much to do with Gradle.
a
Could you tell me what bad practices I did in my grade build file?
v
Ok, "many" was exaggerated, sorry. šŸ˜„ Here some from a very cursory look: • Do not use
gradle.properties
to define version, but use a version catalog • Use a version catalog for all the dependencies • Do not use
subprojects { ... }
or
allprojects { ... }
or
project(...) { ... }
or similar means of cross-project configuration, that makes builds harder to understand, harder to maintain, and immediately introduces project coupling which works against some optimizations and more sophisiticated Gradle features. Better use convention plugins, for example in
buildSrc
or an included build, for example implemented as precompiled script plugins. • Do not use the legacy
apply(...)
way to apply plugins but always the
plugins { ... }
block
a
changing apply() to pluigns{} leads to Using 'plugins(PluginDependenciesSpec.() -> Unit): Nothing' is an error. The plugins {} block must not be used here. If you need to apply a plugin imperatively, please use apply<PluginType>() or apply(plugin = "id") instead.
v
Yes, you first have to resolve the point before. You cannot use
plugins { ... }
in cross-project configuration, but - well - you shouldn't use cross-project configuration. šŸ™‚
āœ… 1
a
Copy code
val ktor_version: String by project
val kotlin_version: String by project
val logback_version: String by project
val koin_ktor: String = "3.5.1"
val mapStructVersion = "latest.release"


plugins {
    java
    checkstyle
    id("com.github.spotbugs")

    //LEAD TO FAIL
    kotlin("jvm") 
    kotlin("kapt") 
    id("io.ktor.plugin") 
    id("org.jetbrains.kotlin.plugin.serialization")
}

group = "com.example"
version = "1.0"

tasks.test {
    useJUnitPlatform()
}

repositories {
    mavenCentral()
}


dependencies {
    implementation( "com.github.javafaker:javafaker:1.0.2")
    testImplementation("junit:junit:4.13")

//many other dependencies, like mapstruct etc...
}
why is this ain't working?
Copy code
FAILURE: Build failed with an exception.

* Where:
Precompiled script plugin 'C:\Users\zwo7a\IdeaProjects\FreshNearMe\buildSrc\src\main\kotlin\myproject.java-conventions.gradle.kts' line: 1

* What went wrong:
Plugin [id: 'org.jetbrains.kotlin.jvm'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (plugin dependency must include a version number for this source)
Some of my dependencies require extra plugins, where should i add them?
v
Why do you ask this in two threads?