Gradle Plugin Test Project Build Failing - gradle

I downloaded the gradle plugin test project from their github here:
https://github.com/gradle/gradle/tree/master/subprojects/docs/src/samples/customPlugin
I also updated gradle to latest (4.7).
When I gradle build the consumer project, I get the following build error:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'consumer'.
Could not resolve all artifacts for configuration ':classpath'.
Could not find org.gradle:customPlugin:1.0-SNAPSHOT.
Searched in the following locations:
file:/C:/Code/gradle/subprojects/docs/src/samples/customPlugin/repo/org/gradle/customPlugin/1.0-SNAPSHOT/maven-
metadata.xml
file:/C:/Code/gradle/subprojects/docs/src/samples/customPlugin/repo/org/gradle/customPlugin/1.0-SNAPSHOT/custom
Plugin-1.0-SNAPSHOT.pom
file:/C:/Code/gradle/subprojects/docs/src/samples/customPlugin/repo/org/gradle/customPlugin/1.0-SNAPSHOT/custom
Plugin-1.0-SNAPSHOT.jar
Required by:
project :
What's the issue here? I guess I don't understand gradle plugins enough. Does the plugin need to be built somehow? I have no 1.0-SNAPSHOT pat or anything of the sort, which seems to be where its looking.

Does the plugin need to be built somehow ?
Yes, at first, otherwise the consumer project won't find it.
Inside the plugin project, just run gradle uploadArchive
And then retry a gradle build inside the consumer project

Related

Could not resolve all files for configuration ':_:detachedConfiguration1' when using node plugin on gradle kotlin dsl

I'm trying to integrate Java and npm Builds Using Gradle Kotlin DSL.
I was going through the example dzone article and github example code.
I'm in npm-app project folder and running the command gradle npm_run_build.
$ gradle npm_run_build
Task :npm-app:nodeSetup FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':npm-app:nodeSetup'.
Could not resolve all files for configuration ':npm-app:detachedConfiguration1'.
Could not find org.nodejs:node:10.14.1.
Searched in the following locations:
- https://nodejs.org/dist/v10.14.1/ivy.xml
Required by:
project :npm-app
BUILD FAILED in 810ms
1 actionable task: 1 executed
How can I fix this error?
try switching your node plugin:
plugins {
id "com.github.node-gradle.node" version "1.5.3"
}

Error: DefaultOperationDescriptor#2b878eea already available in Android Studio

Failed to complete Gradle Execution
When I try to Sync Gradle with Project Files, the error mentioned below appears
Android Studio version that I am using is 3.0.1, Gradle Build 4.1-all.zip
FYI, I have already tried ->Build->Clean Project and Invalidate Cache & Restart and one more thing is that there is no error in my code.
Message Error:
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar]
Error:Failed to complete Gradle execution.
Cause:
Operation org.gradle.tooling.internal.provider.events.DefaultOperationDescriptor#86028ba already available.
BUILD SUCCESSFUL in 8s
Information:1 error
Information:0 warnings
But When I try to Run on my Emulator
The error below appears
Message Error At Run Time
Information:Gradle tasks [:app:assembleDebug]
E:\Android Game App\app\build.gradle
Error:(1, 1) A problem occurred evaluating project ':Android Game App:app'.
Failed to apply plugin [id 'com.android.application']
Due to a limitation of Gradle new variant-aware dependency management, loading the Android Gradle plugin in different class loaders leads to a build error.
This can occur when the buildscript classpaths that contain the Android Gradle plugin in sub-projects, or included projects in the case of composite builds, are set differently.
To resolve this issue, add the Android Gradle plugin to only the buildscript classpath of the top-level build.gradle file.
In the case of composite builds, also make sure the build script classpaths that contain the Android Gradle plugin are identical across the main and included projects.
If you are using a version of Gradle that has fixed the issue, you can disable this check by setting android.enableBuildScriptClasspathCheck=false in the gradle.properties file.
To learn more about this issue, go to https://d.android.com/r/tools/buildscript-classpath-check.html.
Information:BUILD FAILED in 16s
Information:1 error
Information:0 warnings
Information:See complete output in console
Nothing found on Google! Any help would be highly encouraged???
The key to the problem is this line. Maybe due to a project.all in root build.gradle or you are using composite builds.
This can occur when the build script classpaths that contain the Android Gradle plugin in sub-projects,
or included projects in the case of composite builds, are set differently.
that mean in all yours build.gradle you have more than one this line
buildscript {
dependencies {
classpath "com.android.tools.build:gradle:x.y.z"
}
}
what this means is that with the introduction of Android Gradle Plugin 3.Y.Z and the new way of handling dependencies,
if you mix in the same project 2 projects with different plugin version (one with a 2.3 and other with 3.0.1) you will get dragons while compiling.
And this error it's a way to force developer to check it and opt-out once detected and solved.
how to solve it, first ensure you don't use a android gradle plugin below 3.0.1 and use the new dependencies configurations, and add this property on every gradle.properties you have.
android.enableBuildScriptClasspathCheck=false
with that you can now compile
one example could be found at realm sample repo they use a allprojects block that include android gradle plugin on every module. and solve it adding previus gradle property at root gradle.properties

Gradle publishing error to maven; uploadArchives

I want to publish my library github to maven central, trying to push it with gradle uploadArchives
I always get the same error, i've almost search everywhere but there is no clear explanation to host your library in maven central.
Error is;
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':library:androidJavadocs'.
Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): 'C:\DynamicLayout-master\DynamicLayout-master\library\build\tmp\androidJavadocs\javadoc.options'
the log of terminal is here: http://pastebin.com/gKU2Kkpt
this is the lib that i try to publish it; https://github.com/Swisyn/DynamicLayout/tree/master

Can't build workspace in spring tool suite

I am having a problem while creating a spring roo project in spring tool suite..
the problem is it says "building workspace has encountered a problem.error occured during the build.
on viewing details:
Errors occurred during the build.
Errors running builder 'Maven Project Builder' on project 'first'.
Could not calculate build plan: Plugin org.codehaus.mojo:aspectj-maven-plugin:1.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:aspectj-maven-plugin:jar:1.4
Plugin org.codehaus.mojo:aspectj-maven-plugin:1.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:aspectj-maven-plugin:jar:1.4
Could not calculate build plan: Plugin org.codehaus.mojo:aspectj-maven-plugin:1.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:aspectj-maven-plugin:jar:1.4
Plugin org.codehaus.mojo:aspectj-maven-plugin:1.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:aspectj-maven-plugin:jar:1.4
It seems your downloaded dependencies got corrupted somehow.
Try running:
mvn -U clean install
I do answer beacuse I do not have enough reputation to make comment.So;
In STS I got the same error then found #dhamibirendra's answer and I tried and it worked in different way. (Right Clik On Project -->Run as Maven Build(not 3dot)) then write U- clean install on goal and run.(Do not forget to set Maven Runtime to external) After is done I got same error again on same project. Then I delete existing project and create new one and works with no problem. Maybe it helps someone.
Right Click On Project -->Run as Maven Build and click on the option on build clean and install one by one and also run this command in the Goal section U- clean install and click on Run.And refresh the project if you still see the problem then please delete the old project and create new one.
Delete the pom.xml file and paste it again in web content folder.This worked for me.

Download latest release from Artifactory with Gradle

Artifactory has a feature of their API where you can download the latest release of a jar file (See http://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-RetrieveLatestArtifact).
Their example is:
GET http://localhost:8080/artifactory/ivy-local/org/acme/[RELEASE]/acme-[RELEASE].jar
I'm working on a project where all builds get published and I want to grab the jar from the last one. So what I'm looking for is a dependency like this in gradle:
compile "org.acme:acme:1.0.0.9.[RELEASE]"
This fails due to escaping of the square brackets so I tried:
compile "org.acme:acme:1.0.0.9.%5BRELEASE%5D"
This seems to allow gradle/ivy to find the file but it fails because the .pom file version does not match what is defined.
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':project:compile'.
> Could not resolve org.acme:acme:1.0.0.9.%5BRELEASE%5D.
Required by:
org.acme:acme:unspecified
> Could not resolve org.acme:acme:1.0.0.9.%5BRELEASE%5D.
> inconsistent module metadata found. Descriptor: CachedResource: /Users/xxxx/.gradle/caches/artifacts-26/filestore/org.acme/acme/1.0.0.9.%5BRELEASE%5D/pom/3986d9c1a27873ce92c0dbd089fc1ca9618f8c1a/acme-1.0.0.9.%5BRELEASE%5D.pom for http://localhost/artifactory/org/acme/acme/1.0.0.9.%5BRELEASE%5D/acme-1.0.0.9.%5BRELEASE%5D.pom Errors: bad version: expected='1.0.0.9.%5BRELEASE%5D' found='1.0.0.9.80'
Is there any way to get gradle and ivy to pull the latest release from artifactory?
I was able to get this working using the ivy syntax:
compile "org.acme:acme:1.0.0.9.+"
This solves the problem I have but I never did manage to get it working using the Artifactory [RELEASE] url.

Resources