i use gradle-wrapper and have Gradle 6.8 installed.
Succesfull Runs:
bash gradlew check
bash gradlew test
Failed Runs:
`
Task :findMainClass FAILED
Caching disabled for task ':findMainClass' because:
Build cache is disabled
Task ':findMainClass' is not up-to-date because:
Task has not declared any outputs despite executing actions.
:findMainClass (Thread[Execution worker for ':',5,main]) completed. Took 0.001 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':findMainClass'.
'java.io.File org.gradle.api.tasks.SourceSetOutput.getClassesDir()'
`
This is my build.gradle:
`
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.2.RELEASE")
}
}
ext {
bootVersion = "1.5.2.RELEASE"
}
//apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
repositories {
mavenCentral()
//mavenLocal()
//maven { url "http://repo.springsource.org/snapshot" }
//maven { url "http://repo.springsource.org/milestone" }
maven { url "https://repo.spring.io/libs-snapshot" }
}
dependencies {
implementation group: 'org.springframework.cloud', name: 'spring-cloud-core', version: '1.2.9.RELEASE'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-spring-service-connector', version: '1.2.9.RELEASE'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-cloudfoundry-connector', version: '1.2.9.RELEASE'
implementation "org.springframework.boot:spring-boot-starter-actuator:${bootVersion}"
implementation "org.springframework.boot:spring-boot-starter-tomcat:${bootVersion}"
implementation "org.springframework.boot:spring-boot-starter-web:${bootVersion}"
implementation "org.springframework.boot:spring-boot-starter-data-jpa:${bootVersion}"
implementation "org.springframework.boot:spring-boot-starter-thymeleaf:${bootVersion}"
implementation 'com.amazonaws:aws-java-sdk:1.11.113'
runtimeOnly "org.yaml:snakeyaml:1.18"
runtimeOnly "mysql:mysql-connector-java:6.0.6"
implementation group: 'net.minidev', name: 'json-smart', version: '2.3'
}
task wrapper1(type: Wrapper) {
gradleVersion = '6.0.1'
}
`
and this is my gradle-wrapper.properties:
distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=file:///tmp/my-project/gradle-6.8-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists
Can you help me to solve this issue?
I was trying to deploy an cloudfoundry test applciation: https://github.com/cloudfoundry-samples/cf-s3-demo
Related
I have a Gradle project with Kotlin with 3 source folders (main, test, integration). I want to set up different Gradle test tasks for unit and integration tests. That what those test and integration folders are for. I tried several solutions to set up integration test task but nothing worked so far. It's mentioned everywhere that I need to create a different sourceSet for integration, add some configuration to be able to compile the code in that folder properly and set up the task itself. It's all done, but when I run the tests, they fail. The report then says ClassNotFound for everything basically what is inside that(integration) folder.
build.gradle file and the output results are attached below
buildscript {
ext.kotlin_version = '1.3.71'
ext.ktor_version = '1.3.2'
ext.exposed_version = '0.22.1'
ext.kodein_version = '6.5.0'
ext.postgres_version = '42.2.6'
ext.stripe_version = '17.16.0'
ext.junit_version = '5.6.0'
ext.log4j2_version = '2.13.1'
ext.aws_sdk_version = '1.11.734'
ext.html_to_pdf_version = '1.0.0'
ext.kotlintest_version = '4.0.2'
repositories {
maven { url "https://kotlin.bintray.com/kotlinx" }
maven { url "https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/" }
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "javax.jms:jms:1.1"
}
}
plugins {
id("java")
id 'org.jetbrains.kotlin.jvm' version '1.3.71'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.3.71'
id("application")
}
group 'nz.co.redium'
mainClassName = 'nz.co.redium.bookmybusiness.ApplicationKt'
repositories {
mavenCentral()
jcenter()
maven { url "https://dl.bintray.com/kotlin/ktor" }
}
compileKotlin {
kotlinOptions.jvmTarget = "12"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "12"
}
sourceSets {
integration {
java.srcDir "$projectDir/src/integration/kotlin"
kotlin.srcDir "$projectDir/src/integration/kotlin"
resources.srcDir "$projectDir/src/integration/resources"
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
}
configurations {
integrationImplementation.extendsFrom testImplementation
integrationRuntime.extendsFrom testRuntime
}
test {
useJUnitPlatform()
afterTest { desc, result ->
println "Executing test ${desc.name} [${desc.className}] with result: ${result.resultType}"
}
}
//create a single Jar with all dependencies
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Multi-Release': true,
'Main-Class': "$mainClassName"
}
project.archivesBaseName = project.name + '-full'
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
task integrationTest(type: Test) {
useJUnitPlatform()
description = 'Runs the integration tests.'
group = 'verification'
testClassesDirs = sourceSets.integration.output.classesDirs
classpath = sourceSets.integration.runtimeClasspath
outputs.upToDateWhen { false }
mustRunAfter test
afterTest { desc, result ->
println "Executing test ${desc.name} [${desc.className}] with result: ${result.resultType}"
}
}
check.dependsOn integrationTest
dependencies {
implementation "io.ktor:ktor-server-core:$ktor_version"
implementation "io.ktor:ktor-server-host-common:$ktor_version"
implementation "io.ktor:ktor-server-netty:$ktor_version"
implementation "io.ktor:ktor-jackson:$ktor_version"
implementation "io.ktor:ktor-locations:$ktor_version"
implementation "io.ktor:ktor-gson:$ktor_version"
implementation "io.ktor:ktor-client-serialization:$ktor_version"
implementation "io.ktor:ktor-client-serialization-jvm:$ktor_version"
implementation "io.ktor:ktor-client-jetty:$ktor_version"
implementation "org.kodein.di:kodein-di-generic-jvm:$kodein_version"
implementation "org.jetbrains.exposed:exposed-core:$exposed_version"
implementation "org.jetbrains.exposed:exposed-dao:$exposed_version"
implementation "org.jetbrains.exposed:exposed-jdbc:$exposed_version"
implementation "org.jetbrains.exposed:exposed-jodatime:$exposed_version"
implementation "org.postgresql:postgresql:$postgres_version"
implementation "org.apache.logging.log4j:log4j-api:$log4j2_version"
implementation "org.apache.logging.log4j:log4j-core:$log4j2_version"
implementation "org.apache.logging.log4j:log4j-slf4j-impl:$log4j2_version"
implementation "org.springframework.security:spring-security-core:5.1.5.RELEASE"
implementation "com.amazonaws:aws-java-sdk-ses:$aws_sdk_version"
implementation "com.amazonaws:aws-java-sdk-s3:$aws_sdk_version"
implementation "com.stripe:stripe-java:$stripe_version"
implementation "org.apache.velocity:velocity-engine-core:2.1"
implementation "com.openhtmltopdf:openhtmltopdf-core:$html_to_pdf_version"
implementation "com.openhtmltopdf:openhtmltopdf-pdfbox:$html_to_pdf_version"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.10.3"
implementation "org.jetbrains.exposed:exposed-jodatime:$exposed_version"
implementation "io.rest-assured:rest-assured:4.3.0"
implementation "org.hamcrest:hamcrest:2.2"
testImplementation "io.kotest:kotest-runner-junit5-jvm:$kotlintest_version" // for kotest framework
testImplementation "io.kotest:kotest-assertions-core-jvm:$kotlintest_version" // for kotest core jvm assertions
testImplementation "org.assertj:assertj-core:3.11.1"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version"
testImplementation "io.ktor:ktor-server-tests:$ktor_version"
testImplementation "io.ktor:ktor-server-core:$ktor_version"
testImplementation "io.ktor:ktor-server-host-common:$ktor_version"
testImplementation "io.ktor:ktor-gson:$ktor_version"
testImplementation "io.mockk:mockk:1.9.3"
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.5'
testRuntime "org.junit.jupiter:junit-jupiter-engine:$junit_version"
}
> Task :integrationClasses UP-TO-DATE
Skipping task ':integrationClasses' as it has no actions.
:integrationClasses (Thread[Daemon worker Thread 29,5,main]) completed. Took 0.0 secs.
:integrationTest (Thread[Daemon worker Thread 29,5,main]) started.
Gradle Test Executor 19 started executing tests.
Gradle Test Executor 19 finished executing tests.
> Task :integrationTest FAILED
file or directory '/opt/receptioner/bookmybusiness/build/classes/java/integration', not found
Caching disabled for task ':integrationTest' because:
Build cache is disabled
Task ':integrationTest' is not up-to-date because:
Task.upToDateWhen is false.
file or directory '/opt/receptioner/bookmybusiness/build/classes/java/integration', not found
Starting process 'Gradle Test Executor 19'. Working directory: /opt/receptioner/bookmybusiness Command: /usr/lib/jvm/java-13-openjdk-amd64/bin/java -Dorg.gradle.native=false #/tmp/gradle-worker-classpath16424721448345780337txt -Xmx512m -Dfile.encoding=UTF-8 -Duser.country=NZ -Duser.language=en -Duser.variant -ea worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Test Executor 19'
Successfully started process 'Gradle Test Executor 19'
Finished generating test XML results (0.0 secs) into: /opt/receptioner/bookmybusiness/build/test-results/integrationTest
Generating HTML test report...
Finished generating test html results (0.0 secs) into: /opt/receptioner/bookmybusiness/build/reports/tests/integrationTest
:integrationTest (Thread[Daemon worker Thread 29,5,main]) completed. Took 0.523 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':integrationTest'.
> There were failing tests. See the report at: file:///opt/receptioner/bookmybusiness/build/reports/tests/integrationTest/index.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --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 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1s
13 actionable tasks: 1 executed, 12 up-to-date
It's weird though that the failed task refers to classes/java/integration folder (which does't exist) instead of classes/kotlin/integratin folder, which does exist and this is where the compiled code resides in.
It was my bad. After I moved the code from test to integration folder, some resources inside (those which are responsible for initializing the classes) were pointing to the old directory test, not integration. The Gradle build file is correct.
I am making a skeletton of a java project; the gradle build file has an annoying problem : tests are ran twice, one time by the task 'JUnitPlatformTest' and a second time by the task 'test'.
The first one seems to trigger the second, so I can't disable it, and I would like to keep the second one as there is a little difference between them : the first one is in the console (of intelliJ) and the second uses the integrated intelliJ window.
here is gradle.build
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.3'
classpath group: 'de.dynamicfiles.projects.gradle.plugins', name: 'javafx-gradle-plugin', version: '8.8.2'
classpath 'eu.appsatori:gradle-fatjar-plugin:0.3'
}
}
plugins {
id 'java'
id 'edu.sc.seis.launch4j' version '2.4.4'
}
apply plugin: 'org.junit.platform.gradle.plugin'
apply plugin: 'javafx-gradle-plugin'
apply plugin: 'eu.appsatori.fatjar'
junitPlatform {
platformVersion '1.0.3'
reportsDir file('build/test-results/junit-platform')
enableStandardTestTask true
//show results summary even on success.
details details.SUMMARY
filters {
tags {
// Framework tests need to be run only when required to verify that this framework is still working.
exclude "Framework"
}
includeClassNamePatterns '.*Test', '.*Tests'
}
}
group 'lorry'
version '1'
sourceCompatibility = 1.8
//mainClassName="imports.ColorfulCircles"
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
def final junitVersion = "5.2.0"
compile group: 'com.google.inject', name: 'guice', version: '4.1.0'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.2'
compile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junitVersion
//compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.11.0'
compile group: 'org.assertj', name: 'assertj-core', version: '3.9.0'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: junitVersion
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.7.22'
testRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junitVersion
compile 'org.hamcrest:hamcrest-all:1.3'
testCompile "org.testfx:testfx-core:4.0.13-alpha"
testCompile 'org.testfx:testfx-junit5:4.0.13-alpha'
testRuntime 'org.testfx:openjfx-monocle:8u60-b27'
}
test {
useJUnitPlatform()
jvmArgs = [
"-Dtestfx.robot=glass",
"-Dtestfx.headless=true",
"-Dprism.order=sw",
"-Dprism.text=t2k",
"-Dheadless.geometry=1920x1200-32"
]
}
test.dependsOn 'clean'
jfx {
// minimal requirement for jfxJar-task
mainClass = 'imports.ColorfulCircles'
// minimal requirement for jfxNative-task
vendor = 'lolveley'
}
jar {
baseName = 'executable3'
version = ''
manifest {
attributes(
'Class-Path': configurations.compile.collect { it.getName() }.join(' '),
'Main-Class': 'imports.ColorfulCircles'
)
}
}
launch4j {
outfile='bibliotek-v3.exe'
mainClassName = 'imports.ColorfulCircles'
icon = "${projectDir}\\icons\\hands2.ico"
copyConfigurable = project.tasks.fatJar.outputs.files
jar = "lib/${project.tasks.fatJar.archiveName}"
//headerType = "console"
//jar = "${buildDir}\\productFatJar\\fat.jar"
}
junitPlatformTest {
jvmArgs = [
"-Dtestfx.robot=glass",
"-Dtestfx.headless=true",
"-Dprism.order=sw",
"-Dprism.text=t2k",
"-Dheadless.geometry=1920x1200-32"
]
}
and here is the result:
Testing started at 19:25 ...
19:25:01: Executing task 'test'...
> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes
> Task :clean
> Task :compileTestJava
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :junitPlatformTest
constructeur appelé
Before all
Before each
my test 1
Before each
my test 2
This test method should be run
Test run finished after 3630 ms
[ 4 containers found ]
[ 0 containers skipped ]
[ 4 containers started ]
[ 0 containers aborted ]
[ 4 containers successful ]
[ 0 containers failed ]
[ 7 tests found ]
[ 0 tests skipped ]
[ 7 tests started ]
[ 0 tests aborted ]
[ 7 tests successful ]
[ 0 tests failed ]
> Task :test
constructeur appelé
Before all
Before each
my test 1
Before each
my test 2
This test method should be run
BUILD SUCCESSFUL in 13s
5 actionable tasks: 5 executed
19:25:15: Task execution finished 'test'.
According to this official website, ...
The JUnit Platform Gradle Plugin is deprecated
The very basic junit-platform-gradle-plugin developed by the JUnit team was deprecated in JUnit Platform 1.2 and will be discontinued in 1.3. Please switch to Gradle’s standard test task.
So you should remove this plugin from your build file and, if necessary, try to port the remaining settings to the test task of the java plugin.
The below imports are not being recognized in my code:
org.springframework.integration.http.support.DefaultHttpHeaderMapper
org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler
I want to use the HttpRequestExecutingMessageHandler and DefaultHttpHeaderMapper in my code but its unable to recognize it.
I have the below dependencies in my gradle file
buildscript {
ext {
springBootVersion = '1.5.2.RELEASE'
}
repositories {
jcenter()
mavenCentral()
maven { url 'http://repo.spring.io/plugins-release' }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath('org.springframework.build.gradle:propdeps-plugin:0.0.7')
classpath 'org.ajoberstar:gradle-git:1.7.0'
}
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-actuator-docs')
compile('org.springframework.boot:spring-boot-starter-integration')
compile('org.springframework.boot:spring-boot-starter-activemq')
compile('org.springframework.boot:spring-boot-starter-batch')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-cache')
compile('javax.cache:cache-api')
compile('org.ehcache:ehcache:3.+')
compile('org.springframework.cloud:spring-cloud-starter-aws')
compile('com.h2database:h2')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-validation')
compile('org.springframework.retry:spring-retry')
compile "org.apache.commons:commons-lang3:3.4"
compile('commons-codec:commons-codec:1.10')
compile('com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.6.+')
compile 'org.apache.httpcomponents:httpclient:4.5.+'
compile 'org.codehaus.woodstox:woodstox-core-asl:4.4.+'
compile 'com.amazonaws:aws-java-sdk-bom:1.11.115'
compile 'com.amazonaws:aws-java-sdk-s3'
compile group: 'commons-io', name: 'commons-io', version: '2.5'
optional('org.springframework.boot:spring-boot-configuration-processor')
optional('org.springframework.boot:spring-boot-devtools')
}
Should i be using any other imports or should the version of any dependency be different? Please advise.
Looks like you are missing this one:
compile('org.springframework.integration:spring-integration-http')
Spring Boot doesn't provide that dependency by default.
After I added copyBootstrap to build.gradle I am getting the next error when try to run the build task:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project '.
Cannot change dependencies of configuration ':providedCompile' after it has been included in dependency resolution.
How could this issue be solved? I have searched on Internet but no solutions were found. I got the copyBootstrap task from this link. Their goal is to extract all content from org.webjars group jars to a specific path.
I am using Gradle 3.2 and Intellij IDEA 2016.2.5
//group 'org'
//version '1.0-SNAPSHOT'
task wrapper(type: Wrapper) {
gradleVersion = '3.2'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.akhikhl.gretty:gretty:1.4.0'
}
}
repositories {
mavenCentral()
jcenter()
}
//apply plugin: 'java'
//apply plugin: 'eclipse-wtp'
//apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin'
apply plugin: 'war'
apply plugin: 'org.akhikhl.gretty'
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
//compile group: 'org.akhikhl.gretty', name: 'gretty', version: '1.4.0'
// ********************************************************************************************************
// SPRING FRAMEWORK, ORM Y H2DB
// ********************************************************************************************************
compile group: 'org.springframework', name: 'spring-webmvc', version: '4.3.4.RELEASE'
compile group: 'org.springframework', name: 'spring-orm', version: '4.3.4.RELEASE'
compile group: 'org.springframework', name: 'spring-jdbc', version: '4.3.4.RELEASE'
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.2.3.Final'
// ********************************************************************************************************
// JACKSON DATABIND
// ********************************************************************************************************
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.8.4'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.4'
// ********************************************************************************************************
// THYMELEAF
// ********************************************************************************************************
compile group: 'org.thymeleaf', name: 'thymeleaf-spring4', version: '3.0.2.RELEASE'
// ********************************************************************************************************
// SERVLET
// ********************************************************************************************************
compile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0'
// ********************************************************************************************************
// MYSQL CONNECTOR
// ********************************************************************************************************
//compile group: 'mysql', name: 'mysql-connector-java', version: '6.0.5' issues with time zone
compile 'mysql:mysql-connector-java:5.1.6'
// ********************************************************************************************************
// WEB RESOURCES
// ********************************************************************************************************
compile group: 'org.webjars', name: 'angularjs', version: '1.5.8'
compile group: 'org.webjars', name: 'jquery', version: '2.1.4'
compile group: 'org.webjars', name: 'bootstrap', version: '3.3.7'
compile group: 'org.webjars', name: 'jquery-ui', version: '1.12.1'
compile group: 'org.webjars', name: 'modernizr', version: '2.8.3'
// ********************************************************************************************************
// JUNIT AND SPRING TEST
// ********************************************************************************************************
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.springframework', name: 'spring-test', version: '4.3.4.RELEASE'
// ********************************************************************************************************
// GOOGLE DRIVE API
// ********************************************************************************************************
compile group: 'com.google.api-client', name: 'google-api-client', version: '1.22.0'
compile group: 'com.google.apis', name: 'google-api-services-drive', version: 'v2-rev245-1.22.0'
compile group: 'com.google.api-client', name: 'google-api-client-java6', version: '1.22.0'
compile group: 'com.google.oauth-client', name: 'google-oauth-client-jetty', version: '1.22.0'
// ********************************************************************************************************
// DROPBOX API
// ********************************************************************************************************
compile group: 'com.dropbox.core', name: 'dropbox-core-sdk', version: '1.8.2'
// ********************************************************************************************************
// TWITTER API
// ********************************************************************************************************
compile group: 'org.twitter4j', name: 'twitter4j-core', version: '4.0.5'
// compile group: 'org.slf4j', name: 'slf4j-mylearn.api', version: '1.7.21'
// compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.21'
// compile files("twitter/main/webapp/") // add this path as a classpath
}
task copyBootstrap(type: Copy) {
into "$buildDir/static_resources"
configurations.compile
.files({ it.group.equals("org.webjars")})
.each {
from zipTree(it)
}
}
//build.dependsOn(copyBootstrap)
task copyToLib2(type: Copy) {
into "$buildDir/output/libs"
from configurations.runtime
}
war {
archiveName = 'ROOT.war'
destinationDir = file('webapps')
}
// ********************************************************************************************************
// GRETTY SETTINGS
// ********************************************************************************************************
/* Change context path (base url). otherwise defaults to name of project */
gretty {
port = 8081
contextPath = ''
}
This problem seems to be related to the org.akhikhl.gretty plugin you are trying to use. If I try to build a project using the above gradle file I get the following output:
C:\ws\PLAYGROUND\test123>gradle wrapper --stacktrace
Changed dependencies of configuration ':providedCompile' after it has been included in dependency resolution. This behaviour has been deprecated and is cheduled to be removed in Gradle 3.0.
Changed dependencies of parent of configuration ':compile' after it has been resolved. This behaviour has been deprecated and is scheduled to be removed in Gradle 3.0
Changed strategy of configuration ':compile' after it has been resolved. This behaviour has been deprecated and is scheduled to be removed in Gradle 3.0
Changed dependencies of configuration ':grettyProvidedCompile' after it has been included in dependency resolution. This behaviour has been deprecated and is scheduled to be removed in Gradle 3.0.
⋮
* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'test123'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:79)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:74)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
⋮
Caused by: org.gradle.api.InvalidUserDataException: Cannot change dependencies of configuration ':compile' after it has been resolved.
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.validateMutation(DefaultConfiguration.java:578)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$2.run(DefaultConfiguration.java:137)
⋮
at org.akhikhl.gretty.GrettyPlugin$_addDependencies_closure11.doCall(GrettyPlugin.groovy:130)
⋮
That is the gretty plugin seems to use functionality that has been removed with gradle 3.0
There is issue #306 that has been reported a short time ago which describes pretty much your problem.
Given the number of open issues for such a small project and the lack of activity on the issues, I don't think this plugin is much of a help and you will probably be better off using something different.
Before upgrading to Android Gradle Plugin 1.3, the custom lint scope was only Android source files.
After I upgraded to 1.3.1, my tests files started getting checked and as a scenario fails my custom lint rule, the build fails.
There is no documentation about this. I read some warnings have become fatal but nothing around test files getting scanned.
Anyone facing such an issue?
EDIT:
top level build.gradle
buildscript {
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
classpath 'org.sonarqube.gradle:gradle-sonarqube-plugin:1.0'
}
}
allprojects {
repositories {
flatDir {
dirs './prebuilt-libs'
}
mavenCentral()
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.4'
}
Error:
HardCoding: Detects HardCoded "abc" string
../../src/androidTest/java/com/xyz/mobile/trips/test.java:108: HardCoding Found. (This is my custom lint rule)
hasExtra(CODE, "abc")