Error:Cause: org.gradle.internal.component.external.model.DefaultModuleComponentSelector - intellij-idea

My gradle.build
file for simple module is:
buildscript {
ext {
springBootVersion = '1.4.3.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
jar {
baseName = 'client-app'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.cloud:spring-cloud-starter-feign')
// https://mvnrepository.com/artifact/com.netflix.hystrix/hystrix-core
compile('org.springframework.cloud:spring-cloud-starter-hystrix')
compile("org.springframework.boot:spring-boot-starter-web"){
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
compileOnly('org.projectlombok:lombok')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.BUILD-SNAPSHOT"
mavenBom "org.springframework.boot:spring-boot-starter-parent:${springBootVersion}"
}
}
It was working well until I closed the IDE (Intellij IDEA 2016) and reopened. I got error as below:
Error:Cause: org.gradle.internal.component.external.model.DefaultModuleComponentSelector
When I tried to run via cmd, then I got error below:
$ ./gradlew build
:client-app:compileJava
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration 'detachedConfiguration2'.
> Could not resolve org.projectlombok:lombok:.
Required by:
hystrix-example:client-app:unspecified
> Failed to resolve imported Maven boms: Could not find org.springframework.cloud:spring-cloud-dependencies:Camden.BUILD-SNAPSHOT.
Searched in the following locations:
https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-dependencies/Camden.BUILD-SNAPSHOT/maven-metadata.xml
https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-dependencies/Camden.BUILD-SNAPSHOT/spring-cloud-dependencies-Camden.BUILD-SNAPSHOT.pom
https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-dependencies/Camden.BUILD-SNAPSHOT/spring-cloud-dependencies-Camden.BUILD-SNAPSHOT.pom
Required by:
hystrix-example:client-app:unspecified
> Could not find org.springframework.cloud:spring-cloud-starter-feign:.
Searched in the following locations:
https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-starter-feign//spring-cloud-starter-feign-.pom
https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-starter-feign//spring-cloud-starter-feign-.jar
Required by:
hystrix-example:client-app:unspecified
> Could not find org.springframework.cloud:spring-cloud-starter-hystrix:.
Searched in the following locations:
https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-starter-hystrix//spring-cloud-starter-hystrix-.pom
https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-starter-hystrix//spring-cloud-starter-hystrix-.jar
Required by:
hystrix-example:client-app:unspecified
> Could not find org.springframework.boot:spring-boot-starter-web:.
Searched in the following locations:
https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-web//spring-boot-starter-web-.pom
https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-web//spring-boot-starter-web-.jar
Required by:
hystrix-example:client-app:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 9.571 secs
I couldn't figure out the solution.
I already tried gradle build --refresh-dependencies but didn't work for me.
TIA for help.

Finally, I got solution at Issue #5564. :)
As #wilkinson mentioned in his response on that issue, projects are relying on Spring Boot's dependency management and version resolution is failing.
So, I explicitly specified the versions as:
dependencies {
compile('org.springframework.cloud:spring-cloud-starter-feign:1.2.3.RELEASE')
// https://mvnrepository.com/artifact/com.netflix.hystrix/hystrix-core
compile('org.springframework.cloud:spring-cloud-starter-hystrix:1.2.3.RELEASE')
compile("org.springframework.boot:spring-boot-starter-web:1.4.3.RELEASE"){
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
compileOnly('org.projectlombok:lombok:1.16.12')
testCompile('org.springframework.boot:spring-boot-starter-test:1.4.3.RELEASE')
}
And it worked for me. :)

Related

Task :react-native-async-storage_async-storage:generateReleaseRFile FAILED

i got a bug when i build react native apk. last week I built no error. but now an error occurs, even though there is no new package that I installed.
Task :react-native-async-storage_async-storage:generateReleaseRFile FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-async-storage_async-storage:generateReleaseRFile'.
> Could not resolve all files for configuration ':react-native-async-storage_async-storage:releaseCompileClasspath'.
> Failed to transform react-native-0.71.0-rc.0-release.aar (com.facebook.react:react-native:0.71.0-rc.0) to match attributes {artifactType=android-symbol-with-package-name, com.android.build.api.attributes.BuildTypeAttr=release, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-api}.
> Could not find react-native-0.71.0-rc.0-release.aar (com.facebook.react:react-native:0.71.0-rc.0).
Searched in the following locations:
https://repo.maven.apache.org/maven2/com/facebook/react/react-native/0.71.0-rc.0/react-native-0.71.0-rc.0-release.aar
i wish i could build apk
hope this can help you [FIXED] Android build failures No matching variant of com.facebook.react:react-native:0.71.0-rc.0 was found
in my case it was because of using maven's react native version how I fixed it.
android/build.gradle
mavenCentral()
jcenter()
exclusiveContent {
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central
as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }

Unresolved reference: protoc - when using Gradle + Protocol Buffers

I have a gradle project which uses the Kotlin DSL
build.gradle.kts
plugins {
kotlin("jvm") version "1.4.21"
id("com.google.protobuf") version "0.8.10"
}
group = "schema"
version = "0.0.1-SNAPSHOT"
repositories {
mavenCentral()
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.0.0"
}
}
schema.proto
syntax = "proto3";
package schema;
message Message {
string content = 1;
string date_time = 2;
}
and project structure
schema
-src/main/proto/schema.proto
-build.gradle.kts
Whenever I run gradle build I get error:
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/x/schema/build.gradle.kts' line: 13
* What went wrong:
Script compilation errors:
Line 15: protoc {
^ Unresolved reference: protoc
Line 16: artifact = "com.google.protobuf:protoc:3.0.0"
^ Unresolved reference: artifact
* 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
BUILD FAILED in 8s
The only thing I am doing different to various tutorials is using the Gradle Kotlin DSL. What am I doing wrong?
I think this is happening because you are referencing a single task within the protobuf gradle plugin. Try importing the whole bundle to make use of type-safe accessors as you desired.
import com.google.protobuf.gradle.*
For whatever reason this works
import com.google.protobuf.gradle.protoc
protobuf {
protobuf.protoc {
artifact = "com.google.protobuf:protoc:3.0.0"
}
}
It seems a little ugly having to specify protobuf twice mind

How to setup/build LibGDX + Kotlin project correctly?

I've downloaded gdx-setup.jar and try to build empty project with the following settings:
And here is what I get in console:
Generating app in C:\Users\Divelix\Desktop\test
Executing 'C:\Users\Divelix\Desktop\test/gradlew.bat clean --no-daemon idea'
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/4.6/userguide/gradle_daemon.html.
Daemon will be stopped at the end of the build stopping after processing
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':android'.
> Failed to notify project evaluation listener.
> com.android.build.gradle.internal.variant.BaseVariantData.getOutputs()Ljava/util/List;
* 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
BUILD FAILED in 22s
Done!
To import in Eclipse: File -> Import -> General -> Existing Projects into Workspace
To import to Intellij IDEA: File -> Open -> YourProject.ipr
If I do not mark "Use Kotlin" it builds well, so why is that and what am I doing wrong?
Well, I've finally figured out how to build project correctly with Kotlin (and if you have trouble with gradle it also will help you). Firstly, you just should to build it without "Use Kotlin" and than than edit your project build.gradle file like this:
buildscript {
ext.kotlinVersion = '1.1.1'
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
Also you should delete google() if you have it after jcenter()
In :desktop replace java with kotlin plugin and add kotlin-stdlib
project(":desktop") {
apply plugin: "kotlin"
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
}
}
In :android add kotlin-android plugin and kotlin-stdlib
project(":android") {
apply plugin: "android"
apply plugin: "kotlin-android"
configurations { natives }
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
compile "com.badlogicgames.ashley:ashley:$ashleyVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
}
}
In :core replace java with kotlin plugin and add kotlin-stdlib
project(":core") {
apply plugin: "kotlin"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.ashley:ashley:$ashleyVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
}
}
If you have just kotlin issue it would be enough.
If you also have gradle issue like me, so open gradle-wrapper.properties and fix gradle version to 3.3:
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip

Gradle failing to resolve PrimeFaces theme dependency: peer not authenticated

I have a Gradle Java project in which I'm using JSF with PrimeFaces.
In order to change it's theme, I added the required dependency in my build.gradle file, which most important parts are configured as follows:
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
sourceCompatibility = 1.8
version = '1.0'
jar {
manifest {
attributes 'Implementation-Title': 'Arch Project',
'Implementation-Version': version
}
}
repositories {
mavenCentral()
jcenter()
maven { url 'https://repository.primefaces.org' }
maven { url 'https://repository.jboss.org/nexus/content/groups/public' }
}
configurations {
provided
}
sourceSets {
main.compileClasspath += configurations.provided
test.compileClasspath += configurations.provided
test.runtimeClasspath += configurations.provided
}
dependencies {
/* Cryptography API for BCrypt algorithm. */
compile 'de.svenkubiak:jBCrypt:0.4'
/* Primefaces. */
compile 'org.primefaces:primefaces:5.3'
/* Primefaces pepper grinder theme. */
compile 'org.primefaces.themes:pepper-grinder:1.0.10'
... another few dependencies
}
However, when I run gradle build on the console I get the following error:
C:\Users\bruno.gasparotto\git\archproject\archproject>gradle build
:compileJava
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not resolve org.primefaces.themes:pepper-grinder:1.0.10.
Required by:
:archproject:1.0
> Could not HEAD 'https://repository.primefaces.org/org/primefaces/themes/pepper-grinder/1.0.10/pepper-grinder-1.0.10.pom'.
> peer not authenticated
What I've tried and didn't work so far:
Changed the dependency from pepper-grinder to all-themes.
Replaced https with http on PrimeFaces repo configuration in my build.gradle file.
Also, it's important to mention that:
The url https://repository.primefaces.org/org/primefaces/themes/pepper-grinder/1.0.10/pepper-grinder-1.0.10.pom is available if I try to access it through the browser.
I am NOT behind a proxy.
If I remove the pepper-grinder dependency, it works just fine.
The same setup used to work more than year ago, so I believe something new is happening.
Any ideas?
Thanks is advance.

How to run build.gradle with Sikuli integrated into the project?

I am using Sikuli in my project to handle some flash buttons. It's working fine while running scripts locally. The issue is that when I need to run the build.gradle, I need to have the Sikuli dependency in build.gradle. That is how I have written build.gradle. When I run the build, I get this error:
What went wrong: Could not resolve all dependencies for configuration ':compile'.
Could not find com.googlecode.javacpp:javacpp:0.1. Required by:
:new_qa_automation:1.0 > org.sikuli:sikuli-api:1.0.2 > org.sikuli:sikuli-c ore:1.0.1
Could not find com.googlecode.javacv:javacv:0.1. Required by:
:new_qa_automation:1.0 > org.sikuli:sikuli-api:1.0.2 > org.sikuli:sikuli-c ore:1.0.1
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED.
Here is my build.gradle file
apply plugin: 'java' version = '1.0' apply plugin: 'project-report'
repositories { mavenCentral() maven { url
"http://repo.springsource.org/release" url
"http://oss.sonatype.org/content/groups/public/" } }
sourceCompatibility = 1.6 targetCompatibility = 1.6
configurations { cucumberRuntime { extendsFrom testRuntime } }
task test(overwrite: true) {
dependsOn assemble, processTestResources, compileTestJava
doLast {
javaexec {
main = "cucumber.api.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
//some args
systemProperties System.properties
}
} }
dependencies { compile 'org.seleniumhq.selenium:selenium-java:2.32.+'
compile 'org.apache.commons:commons-lang3:3.1' compile
'org.springframework:spring-context:3.2.3.RELEASE'
compile group: 'org.sikuli', name: 'sikuli-api', version: '1.0.+' compile group: 'commons-collections', name: 'commons-collections',
version: '3.+'
testCompile 'info.cukes:cucumber-java:1.1.2'
testCompile 'info.cukes:cucumber-spring:1.1.2'
testCompile 'info.cukes:cucumber-junit:1.1.2'
testCompile 'junit:junit:4.11' testCompile 'org.easytesting:fest-assert-core:2.0+'
}
Edit:
I added the URL for the Maven repositry. Now the error has changed to
ePage.java:9: error: package org.sikuli.script does not exist
import org.sikuli.script.FindFailed;
sikuli-script.jar in Sikuli IDE project not provide in any repository so you must use it like a 3rd party jar
see:
"Mavan's central repository will not answer on any Sikuli stuff" https://answers.launchpad.net/sikuli/+question/185713
"Gradle: Make a 3rd party jar available to local gradle repository" Gradle: Make a 3rd party jar available to local gradle repository
The Sikuli code base appears to be fragmented. It's quite confusing; I know of 3 different sets of Java bindings. (one, two, three)
I think the one you're pulling with Maven is this: http://code.google.com/p/sikuli-api/
If so, org.sikuli.script is not the right import. You don't include your code to show me what you're trying to do with Sikuli, but most of the things you'd want to import are somewhere under org.sikuli.api.
Just download the sikulix jar and mention it in build.gradle
eg: compile files('C:\Users\vedavyasa\Documents\jar\sikulixapi.jar')