avro gradle plugin failing to build using gradle - gradle

I am trying to build the avro gradle plugin using gradle and even though I had set my settings.gradle as :
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
and build.gradle :
plugins {
id "com.github.davidmc24.gradle.plugin.avro" version "1.3.0"
}
repositories {
mavenCentral()
}
dependencies {
implementation "org.apache.avro:avro:1.11.0"
}
generateAvroJava {
source("${projectDir}/src/main/resources/avro")//sourcepath avrofile
}
while executing the gradle build I get the errors below:
* Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.github.davidmc24.gradle.plugin.avro', version: '1.11.0'] was not found in
any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.github.
not sure if I am missing something that is causing it to fail. any ideas.. thanks.

Related

Spring native can't be found

Can't add spring native to an existing project, if I create a new one with spring native selected it works.
org.gradle.internal.exceptions.LocationAwareException: Build file
'/Users/jakob/Documents/worklivery-backend/build.gradle.kts' line: 6
Plugin [id: 'org.springframework.experimental.aot', version: '0.10.4']
was not found in any of the following sources:
Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
plugins{
...
id("org.springframework.experimental.aot") version "0.10.4"
}
repositories {
mavenCentral()
maven { url = uri("https://repo.spring.io/release") }
}
The AOT plugin isn't published to Gradle's plugin portal, it's only available from https://repo.spring.io. You need to add some configuration to your project's settings.gradle file so that it can be resolved:
pluginManagement {
repositories {
maven { url 'https://repo.spring.io/release' }
mavenCentral()
gradlePluginPortal()
}
}
The above matches the configuration from a project generated by https://start.spring.io and adds Maven Central and https://repo.spring.io/release to the plugin repositories in addition to the default Gradle Plugin Portal.

gradle build failed with exception

apply plugin: 'java'
group 'com.CustomWIH'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile 'org.jbpm:jbpm-kie-services:7.20.0.Final'
}
task fatJar(type: Jar) {
baseName='jbpmTutorial'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
jbpm dependency has a dependency that is no longer available in maven repository
org.freemarker version 2.3.26 https://mvnrepository.com/artifact/org.freemarker/freemarker
C:\Users\kona\IdeaProjects\com-CustomWIH>gradle fatJar --stacktrace
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\kona\IdeaProjects\com-CustomWIH\build.gradle' line: 21
What went wrong:
Could not determine the dependencies of task ':fatJar'.
Could not resolve all files for configuration ':compile'.
Could not find org.freemarker:freemarker:2.3.26.jbossorg-1.
Searched in the following locations:
https://repo.maven.apache.org/maven2/org/freemarker/freemarker/2.3.26.jbossorg-1/freemarker-2.3.26.jbossorg-1.pom
https://repo.maven.apache.org/maven2/org/freemarker/freemarker/2.3.26.jbossorg-1/freemarker-2.3.26.jbossorg-1.jar
Required by:
project : > org.jbpm:jbpm-kie-services:7.20.0.Final
I've never ran into this issue before. What do I do in this situation?
Your dependency tree contains this transitive dependency: org.freemarker:freemarker:2.3.26.jbossorg-1, which is not found in Maven Central.
The reason it does not exist in Maven Central is that it is not the normal version of freemarker, but a JBoss patched version, which can be seen from the version of the dependency 2.3.26.jbossorg-1.
Googling for org.freemarker:freemarker:2.3.26.jbossorg-1 took me to this Maven repository: https://repository.jboss.org/nexus/content/groups/public/
The solution would be to add this Maven repository to your build.gradle like this:
repositories {
mavenCentral()
maven {
url "https://repository.jboss.org/nexus/content/groups/public/"
// OR this one, as suggested by jb-nizet
// url "https://maven.repository.redhat.com/ga/"
}
}

Gradle doesn't find plugins: org.jetbrains.kotlin.jvm and kotlin2js

I'm a beginner in gradle, using version 4.8.
Whatever I do , the plugins are never found. I get this error message:
Plugin [id: 'org.jetbrains.kotlin.jvm', version: '1.3.20'] was not found in any of the following sources:
Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
Plugin Repositories (could not resolve plugin artifact 'org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.3.20')
Searched in the following repositories:
Gradle Central Plugin Repository
No matter how many repositories I add, it seems it is only looking in "Gradle Central Plugin Repository"
My gradle.build file:
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20"
classpath "org.jetbrains.kotlin.jvm:kotlin-gradle-plugin:1.3.20"
}
}
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.20'
id 'kotlin2js' version '1.3.20'
}
Can you help me?
Try the following gradle.build configuration:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20"
}
}
plugins {
id 'java'
}
apply plugin: 'kotlin2js'
repositories {
mavenCentral()
}
When you include the plugin by id, it seems Gradle wants to retrieve the plugin from the Gradle plugin portal, but the Kotlin plugin is not there, it's part of the buildscript dependency. Using it with the apply plugin works. You can also find a slightly different working example here.
I had similar problem because i forgot about proxy settings like systemProp.https.proxyHost and systemProp.http.proxyHost and etc. that was set in ~/.gradle/gradle.properties.
I fixed configuration and plugin was successfully dowlnloaded
Check gradle.properties and try to add correct proxy settings if you behind firewall or escape this settings if you not.
you need to add repository mavenCentral() to the buildscript dependencies.
for example: kotlin-gradle-plugin:1.3.20. also the documentation hints for that.
Go to your project and then to the Gradle script. In Gradle, Go to Setting.Gradle and change the Fist Bitray Url to https://plugins.gradle.org/m2/.

Gradle dependency management plugin

I am trying to run the following minimal gradle build file including the dependency management plugin:
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
}
plugins {
id "java"
id "io.spring.dependency-management" version "1.0.4.RELEASE"
}
But then running gradle fails:
* What went wrong:
Plugin [id: 'io.spring.dependency-management', version: '1.0.4.RELEASE'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'io.spring.dependency-management:io.spring.dependency-management.gradle.plugin:1.0.4.RELEASE')
Searched in the following repositories:
Gradle Central Plugin Repository
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.5.1/userguide/command_line_interface.html#sec:command_line_warnings
Is there a missing dependency in the gradle file?
The plugin cannot be found because you defined repositories inside your build script and tried to use plugin outside it. Remove buildscript or add repositories for your build file also.
(Dependencies and repositories defined inside build script are accessible in that buildscript scope)
Example:
plugins {
id "java"
id "io.spring.dependency-management" version "1.0.4.RELEASE"
}
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}

gradle build for kotlin code

I'm trying to set up a project building Kotlin code with Gradle. I've followed instructions here on how to set up the build.gradle file but am receiving an error
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.0'
}
}
apply plugin: 'kotlin'
With this I get the error:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'kjsonparser'.
Could not resolve all files for configuration ':classpath'.
Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.0.
Required by:
project :
Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.0.
Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0/kotlin-gradle-plugin-1.2.0.pom'.
Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0/kotlin-gradle-plugin-1.2.0.pom'.
java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
I've also tried the "newer" way of specifing the plugin
plugins {
id "org.jetbrains.kotlin.jvm" version "1.2.0"
}
Which gives this error:
What went wrong:
Plugin [id: 'org.jetbrains.kotlin.jvm', version: '1.2.0'] was not found in any >of the following sources:
Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact >'org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.2.0')
Searched in the following repositories:
Gradle Central Plugin Repository
Version of Gradle
gradle -version
------------------------------------------------------------
Gradle 4.4
Kotlin (and openjdk)
kotlin -version
Kotlin version 1.2.0 (JRE 1.8.0_151-8u151-b12-0ubuntu0.17.10.2-b12)
Running on Ubuntu 17.10
I've never worked with Gradle before so not sure if I'm missing anything in the build file
Try this. It works:
buildscript {
ext.kotlin_version = '1.2.10'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin'
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
I never use the buildscript block.
Try this instead:
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.4.31'
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.4.31'
}

Resources