Downloaded an android project having a problem I have this in a gradle file...
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.21.5'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
But I am getting the error..
Plugin with id 'com.android.application' not found
Any ideas what the problem is?
try in root gradle:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// 2.1.2 is newest plugin but required studio >= 2.1
classpath 'com.android.tools.build:gradle:1.5.0'
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
in app or lib gradle:
apply plugin: 'com.android.application'
//Put Fabric plugin after Android plugin
apply plugin: 'io.fabric'
for fabric version plugin see:
https://s3.amazonaws.com/fabric-artifacts/repo/io/fabric/tools/gradle/maven-metadata.xml
<latest>1.21.5</latest>
<release>1.21.6</release>
btw don't use plus sign in libs/classes it's slows down the build process: instead classpath 'io.fabric.tools:gradle:1.+' use -> classpath 'io.fabric.tools:gradle:1.21.6'
Related
I am trying to accomplish a Java Spring course at Coursera and downloaded the project with this gradle file.
buildscript {
ext {
springBootVersion = '2.1.0.RELEASE'
}
repositories {
maven { url "https://repo.spring.io/libs-snapshot" }
mavenLocal()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.0.2.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'war'
sourceCompatibility = 1.8
targetCompatibility = 1.8
war {
baseName = 'gs-convert-jar-to-war'
version = '0.1.0'
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/libs-snapshot" }
maven { url "http://maven.springframework.org/milestone" }
flatDir {
dirs 'lib'
}
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.boot:spring-boot-starter-aop")
compile("org.springframework.boot:spring-boot-starter-test")
compile("org.springframework.boot:spring-boot-starter-jetty")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.springframework.data:spring-data-rest-webmvc")
compile("org.apache.httpcomponents:httpclient:4.5.6")
compile("org.hsqldb:hsqldb")
compile("com.google.guava:guava:17.0")
compile("org.apache.commons:commons-lang3:3.3.2")
compile("com.squareup.retrofit:retrofit:1.6.0")
compile("commons-io:commons-io:2.4")
compile("com.github.davidmarquis:fluent-interface-proxy:1.3.0")
compile(":mobilecloud.handin:1.0.0")
compile(":video.up.test:1.0.0")
compile(":autograder.handin:1.0.0")
compile(":autograder.spec:1.0.0")
testCompile("junit:junit")
}
Unfortunately, I have this error in IntelliJ Idea :
A problem occurred configuring root project 'mobile-cloud-asgn1'.
> Failed to notify project evaluation listener.
> org.gradle.api.tasks.SourceSetOutput.getClassesDir()Ljava/io/File;
I am quite a newbie to Java and Gradle and never faced errors like this, so I have no idea how to fix it. Can anyone help me?
P.S. Repository with project template: https://github.com/juleswhite/mobile-cloud-asgn1
I have very simple java project, and I'm using gradle to build it.
And I have Linux RedHat server (without access to internet) but this server has access to internal nexus repository where all required dependencies present.
This is build.gradle file:
buildscript {
ext {
springBootVersion = '2.0.3.RELEASE'
}
repositories {
maven { url "https://nexus.com.mysite/nexus/content/repositories/mirror/" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
plugins {
id 'com.github.jacobono.jaxb' version '1.3.5' // this is 14 line
}
repositories {
maven { url "https://nexus.com.mysite/nexus/content/repositories/mirror/" }
}
subprojects {
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'maven'
apply plugin: 'io.spring.dependency-management'
sourceCompatibility = 1.8
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
}
}
buildscript {
repositories {
maven { url "https://nexus.com.mysite/nexus/content/repositories/mirror/" }
}
}
repositories {
maven { url "https://nexus.com.mysite/nexus/content/repositories/mirror/" }
}
}
allprojects {
buildscript {
repositories {
maven { url "https://nexus.com.mysite/nexus/content/repositories/mirror/" }
}
}
}
Settings file settings.gradle:
include 'api'
project(":api").name = "api"
And this project has 1 submodule api filder.
api build.gradle file:
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.github.jacobono.jaxb'
springBoot {
buildInfo()
}
group = 'com.example'
version = '1.0.0'
sourceCompatibility = 1.8
repositories {
maven { url "https://nexus.com.mysite/nexus/content/repositories/mirror/" }
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
}
springBoot {
mainClassName = 'com.example.TestApplication'
}
On my linux server I have:
- java 8
- gradle 4.5.1
- mvn 3.5.6
When I'm running gradle clean inside root folder of my project, after 5-10 mins I'm receiving error:
FAILURE: Build failed with an exception.
* Where:
Build file '/my-proj/build.gradle' line: 14
* What went wrong:
Plugin [id: 'com.github.jacobono.jaxb', version: '1.3.5'] 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.jacobono.jaxb:com.github.jacobono.jaxb.gradle.plugin:1.3.5')
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
BUILD FAILED in 10m 3s
And for some reason in this error there is no information about my nexus repository...I assuming that it even haven't tried this repository. And the question is why...?
I would be very happy of any help...maybe I made mistake in build.gradle file somewhere...
p.s. on my local pc(I have access to internet and to this repository everything works file)
Plugins by default resolved from Gradle Plugin Portal. If you want to resolve them from different sources, You should add configuration to settings.gradle file.
Example:
pluginManagement {
repositories {
maven {
url '../maven-repo'
}
gradlePluginPortal()
ivy {
url '../ivy-repo'
}
}
}
Check the docs for details.
I want to add the tomcat plugin to my gradle build, but the plugin cannot be found , gradle shows the error
Plugin with id 'com.bmuschko.tomcat' not found.
I followed the steps on the github page of this plugin, but it does not work.
In my project I have general build.gradle in this I am loading my project.gradle in this I defined the tomcat-plugin configuration.
build.gradle
apply plugin: 'java'
apply plugin: 'maven'
sourceCompatibility = 1.8
ext {
debug = false
}
apply from: 'project.gradle'
group = myGroup
version = myVersion + '-SNAPSHOT'
project.gradle
//https://github.com/bmuschko/gradle-tomcat-plugin
buildscript {
repositories {
jcenter();
}
dependencies {
classpath 'com.bmuschko:gradle-tomcat-plugin:2.4.2'
}
}
apply plugin: "com.bmuschko.tomcat"
apply plugin: "idea"
apply plugin: "project-report"
apply plugin: "war"
I can ensure that dependencies can be resolved from my machine, because other gradle projects work, so that it should not be a network issue, there is no proxy configuration etc.
You have to put buildscript{} into your main build.gradle. The buildscript process is outside the regular Gradle build. Same applies to plugins{} as well (since they are equivalent.)
So if you put
buildscript {
repositories {
jcenter();
}
dependencies {
classpath 'com.bmuschko:gradle-tomcat-plugin:2.4.2'
}
}
into your build.gradle, it would work.
[Update]
I have created a sample gradle project with the fix in it.
And the TravisCI build is here.
Or you may try using the plugin type:
apply plugin: com.bmuschko.gradle.tomcat.TomcatPlugin
instead of
apply plugin: "com.bmuschko.tomcat"
in your project.gradle file.
I'm using Intellij IDEA 2017.2.4 and Gradle 4.0.1
I have few Spring Boot services. And I facing a problem to run them, they can fail while starting in a random way because of missing dependencies.
I have a parent project with build.gradle:
buildscript {
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://plugins.gradle.org/m2/" }
mavenLocal()
}
dependencies {
classpath("io.spring.gradle:dependency-management-plugin:$dependencyManagementPluginVersion")
classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")
}
}
allprojects {
apply plugin: 'java'
apply plugin: 'idea'
group = '***'
version = '***'
}
subprojects {
sourceCompatibility = 1.8
targetCompatibility = 1.8
processResources {
filesMatching('**/*.yml') {
expand(project.properties)
}
}
apply plugin: 'io.spring.dependency-management'
dependencyManagement {
imports {
mavenBom("org.springframework.cloud:spring-cloud-dependencies:$springCloudVersion")
mavenBom("org.springframework.boot:spring-boot-dependencies:$springBootVersion")
}
dependencies {
dependency "com.google.cloud:google-cloud-storage:$googleCloudStorageVersion"
...
dependency "org.junit.jupiter:junit-jupiter-api:$junitVersion"
}
}
}
And a child project build.gradle:
apply plugin: 'org.springframework.boot'
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
mavenLocal()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
...
testCompile('com.h2database:h2')
}
In some cases lombok dependency is missed, in other javax dependency. It shows that dependencies are not there.
But after I press Refresh All Gradle Projects and build once again it works.
Maybe someone encountered the same issue and have some solution for it?
It seems that you have problem with lombok dependency. First step is to ensure that lombok is added as your compile time dependency for example:
repositories {
mavenCentral()
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.16.18'
}
Second step is to ensure that you have newest lombok plugin installed on your Intellij. It is very important when you are trying to compile your project inside IDE. Another thing that may help is setting to autoupdate dependencies in Intellij configuration.
I just updated to using Android Studio 3.0 Canary 2. Upon opening my project Android Studio suggested I update the gradle version to 3.0.0-alpha2. My goal is to use the "Enable advanced profiling" Run Configuration so I can run a realtime memory-analysis. However the instant my gradle version was updated, my project fails to build. I followed the update instructions here.
The only changes made were to my top-level build.gradle file and the gradle-wrapper.properties file.
My top-level build.gradle:
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
classpath 'com.github.Archinamon:GradleAspectJ-Android:2.3.0'
classpath 'me.tatarka:gradle-retrolambda:3.5.0'
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven { url 'https://repo.adobe.com/nexus/content/repositories/releases/' }
maven { url 'http://maven.localytics.com/public' }
}
}
And I updated the gradle-wrapper.properties distributionURL to:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip
The error I get is:
Failed to apply plugin [id'com.archinamon.aspectJ']
And here is the offending part of my app-level build.gradle file:
import java.text.SimpleDateFormat
apply plugin: 'com.android.application'
apply plugin: 'com.archinamon.aspectj'
aspectj {
includeAspectsFromJar 'Android_MTAgent'
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
....
}
So the problem seems to be with the aspectJ plugin. If I remove the plugin for aspectJ and the related aspectJ block (both shown above) then it compiles (I get a dimen error then though, but I already saw that mentioned elsewhere, so I guess that can be solved.)
I'd appreciate any pointers/ideas in regard to the above issue.
Change your project build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
}
to
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha3'
}
and update your Archinamon classpath reference in the same build.gradle file to:
classpath 'com.github.Archinamon:GradleAspectJ-Android:3.0.2'