I am using Gradle 3.5.1 in multi-module project and trying to apply docker-remote-api plugin to one of the modules and have following error while import Gradle changes in IDE.
build.gradle
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.bmuschko:gradle-docker-plugin:6.1.3"
}
}
apply plugin: 'com.bmuschko.docker-remote-api'
And I have following error which refers to the line with 'apply plugin......'
Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes
precedence.
java.lang.NullPointerException
at org.codehaus.groovy.runtime.DefaultGroovyMethods.with(DefaultGroovyMethods.java:239)
at org.codehaus.groovy.runtime.dgm$757.doMethodInvoke(Unknown Source)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1027)
Related
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.
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/"
}
}
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'
}
I'm trying to add the library Exposed to my project. So, it leads me to the bintray page where it says to use compile 'org.jetbrains.exposed:exposed:0.8.5'. I open my file build.gradle and place that file into the dependencies segment:
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
compile 'org.jetbrains.exposed:exposed:0.8.5'
}
IntelliJ auto builds it and I get the following error
Warning:root project 'DB-Table-To-Orm': Unable to build Kotlin
project configuration Details:
java.lang.reflect.InvocationTargetException: null Caused by:
org.gradle.api.artifacts.ResolveException: Could not resolve all
dependencies for configuration ':compileClasspath'. Caused by:
org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not
find org.jetbrains.exposed:exposed:0.8.5. Searched in the following
locations:
https://repo1.maven.org/maven2/org/jetbrains/exposed/exposed/0.8.5/exposed-0.8.5.pom
https://repo1.maven.org/maven2/org/jetbrains/exposed/exposed/0.8.5/exposed-0.8.5.jar
Required by:
project :
So, I look in the repo and there is no path beyond jetbrains with the exposed directory.
How do I install the Exposed library with Gradle? Do they have the path written down incorrectly? Should I put in a bug report with the project? Or am I just putting the compile statement in the wrong location?
Sorry, if this seems like a silly request, I'm new to Javaland and Kotlin and IntelliJ. Coming for the .NET world.
Update
Here's the build.gradle in its entirety:
group 'com.awebsite.db-table-to-orm'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.1.4-2'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin'
repositories {
mavenCentral()
jcenter()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
compile 'org.jetbrains.exposed:exposed:0.8.5'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
As far as I know Exposed isn't in the main bintray repo (aka jcenter). To make gradle search in Exposed's repo you need to add this:
maven {
url "https://dl.bintray.com/kotlin/exposed"
}
to your repositories section.
Example:
repositories {
mavenCentral()
maven {
url "https://dl.bintray.com/kotlin/exposed"
}
}
Then just rebuild and it should work just fine
Objective:
Use gradle to build TomEE project.
Gradle Script:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.apache.tomee.gradle:tomee-embedded:7.0.1'
}
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'org.apache.tomee.tomee-embedded'
repositories {
mavenLocal()
mavenCentral()
}
Gradle call: gradle tomee-embedded
Execution failed for task ':tomee-embedded'.
org.gradle.api.logging.LoggingManager.setLevel(Lorg/gradle/api/logging/LogLevel;)Lorg/gradle/api/logging/LoggingManager;
Error cause by:
Caused by:
java.lang.NoSuchMethodError:
org.gradle.api.logging.LoggingManager.setLevel(Lorg/gradle/api/logging/LogLevel;)Lorg/gradle/api/logging/LoggingManager;
Did I happen to miss to add gradle dependency? Shouldnt gradle know that it has to add its APIs as well? Do i do it manually? I tried adding to classpath all gradle api libraries but with no success. Anyone has ideas?
I think it got fixed in 7.0.2, gradle API changed on that area