How to solve this error?
Error:(24, 1) A problem occurred evaluating root project 'myproject10'.
Failed to apply plugin [id 'org.gradle.checkstyle']
Could not create service of type CachingFileHasher using TaskExecutionServices.createFileSnapshotter().
subprojects {
def projectName = it.name
if (projectName != "graphql-java-support") {
apply from: "../gradle/dependencies.gradle"
}
buildscript {
System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true'
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
}
repositories {
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url 'https://maven.google.com' }
}
if (projectName != "graphql-java-support") {
apply plugin: 'checkstyle'
checkstyle {
toolVersion = "5.9"
configFile rootProject.file('checkstyle.xml')
configProperties = ['checkstyle.cache.file': rootProject.file('build/checkstyle.cache')]
ignoreFailures false
showViolations true
}
task checkstyle(type: Checkstyle) {
source 'src/main/java'
include '**/*.java'
classpath = files()
}
afterEvaluate {
if (project.tasks.findByName('check')) {
check.dependsOn('checkstyle')
}
}
}
}
project.ext.preDexLibs = !project.hasProperty('disablePreDex')
subprojects {
project.plugins.whenPluginAdded { plugin ->
if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
} else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
}
}
}
I try to build java library using android studio and want to host at my local artifactory.
I face this problem at noon. Try different code, but no improvements.
buildscript {
repositories {
jcenter()
}
repositories {
maven {
url 'http://localhost:8081/artifactory/libs-release-local'
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
name = "maven-main-cache"
}
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.0.1"
}
}
project.getExtensions().getByName("ext")
apply plugin: 'scala'
apply plugin: 'maven-publish'
apply plugin: "com.jfrog.artifactory"
version = '1.0.0-SNAPSHOT'
group = 'com.buransky'
repositories {
add buildscript.repositories.getByName("maven-main-cache")
}
dependencies {
compile 'org.scala-lang:scala-library:2.11.2'
}
tasks.withType(ScalaCompile) {
scalaCompileOptions.useAnt = false
}
artifactory {
contextUrl = "${artifactory_contextUrl}"
publish {
repository {
repoKey = 'libs-snapshot-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
defaults {
publications ('mavenJava')
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
Above my build.gradle code block.
Please help. I didn't found any solutions in google
Looking here it looks like it's
artifactory {
publish {
repository {
ivy {
mavenCompatible = true
}
}
}
}
Instead of
artifactory {
publish {
repository {
maven = true
}
}
}
I have a multiproject build where I need to publish some dependencies to a custom local Maven repository on disk and then add this folder to a distribution zip.
I define publishing tasks for each subproject using the maven-publish plugin.
subprojects {
apply plugin: 'maven-publish'
configurations {
offlineDependencies
}
publishing {
publications {
configurations.each { config ->
if (config.name == "offlineDependencies") {
def files = config.files
config.dependencies.each { dep ->
files.each { file ->
if (file.name == "${dep.name}-${dep.version}.jar") {
"${dep.name}"(MavenPublication) {
artifact (file) {
groupId = "${dep.group}"
artifactId = "${dep.name}"
version = "${dep.version}"
}
}
}
}
}
}
}
}
repositories {
maven {
name 'dependencies'
url '../build/repository'
}
}
}
}
Using the distribution plugin I create a zip file
distributions {
release {
baseName 'release'
contents {
from('src/main/resources/')
into("repository"){
from("$buildDir/repository")
}
}
}
}
How can I make sure that all the dynamically created publish tasks are run before creating the zip file?
I tried making a new task for all subprojects that depends on the dynamically created tasks, but it seems they're not created yet at that time.
subprojects {
task offlineDep << {
println 'Creating offline dependencies'
}
offlineDep.dependsOn {
tasks.findAll { task -> task.name.endsWith('PublicationToDependenciesRepository') }
}
}
I found a solution to this problem. By collecting the names of the artifacts and generating the tasknames I know will be created later and adding them as dependencies.
subprojects {
apply plugin: 'maven-publish'
def offlineDependencyNames = []
publishing {
publications {
configurations.each { config ->
if (config.name == "offlineDependencies") {
def files = config.files
config.dependencies.each { dep ->
files.each { file ->
if (file.name == "${dep.name}-${dep.version}.jar") {
offlineDependencyNames << dep.name
"${dep.name}"(MavenPublication) {
artifact (file) {
groupId = "${dep.group}"
artifactId = "${dep.name}"
version = "${dep.version}"
}
}
}
}
}
}
}
}
repositories {
maven {
name 'dependencies'
url "${rootProject.buildDir}/repository"
}
}
}
task publishOfflineDependencies
publishOfflineDependencies.dependsOn {
offlineDependencyNames.collect { name ->
"publish${name[0].toUpperCase()}${name.substring(1)}PublicationToDependenciesRepository"
}
}
}
releaseDistZip.dependsOn {
subprojects.collect {
p -> p.path + ':publishOfflineDependencies'
}
}
Error:Execution failed for task ':imagepipeline:ndk_build_bitmaps'.
A problem occurred starting process 'command 'ndk-build.cmd''
How to solve?The problem with for a long time, don't know how to do?For the great spirit guide
apply plugin: 'com.android.library'
apply plugin: 'maven'
project.group = GROUP
version = VERSION_NAME
apply plugin: 'org.robolectric'
apply plugin: 'de.undercouch.download'
import de.undercouch.gradle.tasks.download.Download
import org.apache.tools.ant.taskdefs.condition.Os
dependencies {
provided "com.google.code.findbugs:jsr305:${JSR_305_VERSION}"
compile "com.parse.bolts:bolts-android:${BOLTS_ANDROID_VERSION}"
compile "com.nineoldandroids:library:${NINEOLDANDROID_VERSION}"
compile "com.android.support:support-v4:${SUPPORT_V4_VERSION}"
provided "javax.annotation:javax.annotation-api:${ANNOTATION_API_VERSION}"
compile project(':fbcore')
testCompile "com.google.guava:guava:${GUAVA_VERSION}"
testCompile "junit:junit:${JUNIT_VERSION}"
testCompile "org.mockito:mockito-core:${MOCKITO_CORE_VERSION}"
testCompile "org.powermock:powermock-api-mockito:${POWERMOCK_VERSION}"
testCompile "org.powermock:powermock-module-junit4-rule:${POWERMOCK_VERSION}"
testCompile "org.powermock:powermock-classloading-xstream:${POWERMOCK_VERSION}"
testCompile("org.robolectric:robolectric:${ROBOLECTRIC_VERSION}") {
exclude group: 'commons-logging', module: 'commons-logging'
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
}
apply from: rootProject.file('release.gradle')
// We download various C++ open-source dependencies from SourceForge into nativedeps/downloads.
// We then copy both downloaded code and our custom makefiles and headers into nativedeps/merge.
def nativeDepsDir = new File("${projectDir}/nativedeps")
def downloadsDir = new File("${nativeDepsDir}/downloads")
def mergeDir = new File("${nativeDepsDir}/merge")
task createNativeDepsDirectories {
nativeDepsDir.mkdirs()
downloadsDir.mkdirs()
mergeDir.mkdirs()
}
task downloadGiflib(dependsOn: createNativeDepsDirectories, type: Download) {
src 'http://downloads.sourceforge.net/project/giflib/giflib-5.1.1.tar.gz'
onlyIfNewer true
overwrite false
dest downloadsDir
}
task downloadLibjpeg(dependsOn: createNativeDepsDirectories, type: Download) {
src 'http://downloads.sourceforge.net/project/libjpeg-turbo/1.3.1/libjpeg-turbo-1.3.1.tar.gz'
onlyIfNewer true
overwrite false
dest downloadsDir
}
task downloadLibpng(dependsOn: createNativeDepsDirectories, type: Download) {
src 'http://downloads.sourceforge.net/project/libpng/libpng16/older-releases/1.6.10/libpng-1.6.10.tar.gz'
onlyIfNewer true
overwrite false
dest downloadsDir
}
task downloadLibwebp(dependsOn: createNativeDepsDirectories, type: Download) {
src 'https://github.com/webmproject/libwebp/archive/v0.4.2.tar.gz'
onlyIfNewer true
overwrite false
dest downloadsDir
}
task unpackGiflib(dependsOn: downloadGiflib, type: Copy) {
from tarTree(resources.gzip("${downloadGiflib.dest}/giflib-5.1.1.tar.gz"))
into "${downloadsDir}"
}
task unpackLibjpeg(dependsOn: downloadLibjpeg, type: Copy) {
from tarTree(resources.gzip("${downloadLibjpeg.dest}/libjpeg-turbo-1.3.1.tar.gz"))
into "${downloadsDir}"
}
task unpackLibpng(dependsOn: downloadLibpng, type: Copy) {
from tarTree(resources.gzip("${downloadLibpng.dest}/libpng-1.6.10.tar.gz"))
into "${downloadsDir}"
}
task unpackLibwebp(dependsOn: downloadLibwebp, type: Copy) {
from tarTree(resources.gzip("${downloadLibwebp.dest}/v0.4.2.tar.gz"))
into "${downloadsDir}"
}
task copyGiflib(dependsOn: unpackGiflib, type: Copy) {
from "${unpackGiflib.destinationDir}/giflib-5.1.1/lib"
from 'src/main/jni/third-party/giflib'
include('*.c', '*.h', '*.mk')
into "${mergeDir}/giflib"
}
task copyLibjpeg(dependsOn: unpackLibjpeg, type: Copy) {
from "${unpackLibjpeg.destinationDir}/libjpeg-turbo-1.3.1"
from 'src/main/jni/third-party/libjpeg-turbo-1.3.x'
include('**/*.c', '**/*.h','**/*.S', '**/*.asm', '**/*.inc', '*.mk')
into "${mergeDir}/libjpeg-turbo-1.3.x"
}
task copyLibpng(dependsOn: unpackLibpng, type: Copy) {
from "${unpackLibpng.destinationDir}/libpng-1.6.10"
from 'src/main/jni/third-party/libpng-1.6.10'
include('**/*.c', '**/*.h', '**/*.S', '*.mk')
into "${mergeDir}/libpng-1.6.10"
}
task copyLibwebp(dependsOn: unpackLibwebp, type: Copy) {
from "${unpackLibwebp.destinationDir}/libwebp-0.4.2"
from 'src/main/jni/third-party/libwebp-0.4.2'
include('src/**/*.c', 'src/**/*.h', '*.mk')
into "${mergeDir}/libwebp-0.4.2"
}
task fetchNativeDeps(dependsOn: [copyGiflib, copyLibjpeg, copyLibpng, copyLibwebp]) {
}
task removeNativeDeps(type: Delete) {
delete nativeDepsDir
}
allclean.dependsOn removeNativeDeps
def getNdkBuildName() {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
return "ndk-build.cmd"
} else {
return "ndk-build"
}
}
def getNdkBuildFullPath() {
// we allow to provide full path to ndk-build tool
if (hasProperty('ndk.command')) {
return property('ndk.command')
}
// or just a path to the containing directiry
if (hasProperty('ndk.path')) {
def path = property('ndk.path')
if (!path.endsWith(File.separator)) {
path += File.separator
}
return path + getNdkBuildName()
}
// if none of above is provided, we assume ndk-build is already in $PATH
return getNdkBuildName()
}
def makeNdkTasks(String name, Object[] deps) {
task "ndk_build_$name"(dependsOn: deps, type: Exec) {
inputs.file("src/main/jni/$name")
outputs.dir("$buildDir/$name")
commandLine getNdkBuildFullPath(),
'NDK_PROJECT_PATH=null',
'NDK_APPLICATION_MK=../Application.mk',
'NDK_OUT=' + temporaryDir,
"NDK_LIBS_OUT=$buildDir/$name",
'-C', file("src/main/jni/$name").absolutePath,
'--jobs', '8'
}
task "ndk_clean_$name"(type: Exec) {
ignoreExitValue true
commandLine getNdkBuildFullPath(),
'NDK_PROJECT_PATH=null',
'NDK_APPLICATION_MK=../Application.mk',
'NDK_OUT=' + temporaryDir,
"NDK_LIBS_OUT=$buildDir/$name",
'-C', file("src/main/jni/$name").absolutePath,
'clean'
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn "ndk_build_$name"
}
clean.dependsOn "ndk_clean_$name"
}
android {
def ndkLibs = [
['bitmaps', []],
['gifimage', [copyGiflib]],
['imagepipeline', [copyLibjpeg, copyLibpng, copyLibwebp]],
['memchunk', []],
['webpimage', [copyLibwebp]]]
buildToolsVersion "21.1.2"
compileSdkVersion 21
sourceSets {
main {
jni.srcDirs = []
jniLibs.srcDirs = ndkLibs.collect { "$buildDir/${it[0]}" }
}
}
ndkLibs.each { lib -> makeNdkTasks lib[0], lib[1] }
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
artifacts.add('archives', sourcesJar)
You don't have ndk-build in the path.
Have you configured the android-ndk properly?
Try adding it and that problem should be solved
Have an err with compiling gradle idea
error see on screen
http://upwap.ru/1884422
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'code-quality'
apply plugin: 'groovy'
apply plugin: 'eclipse'
apply plugin: 'project-reports'
sourceCompatibility = 1.6 archivesBaseName = 'opas-client'
ideaModule { downloadJavadoc = true }
buildscript {
repositories {
mavenRepo urls: "f:/dev/lib/"
}
}
version = '0.1'
gradle.taskGraph.whenReady {taskGraph ->
if (taskGraph.hasTask(':release')) {
version = '0.1.2' // } else { // version = '1.0.624'
}
}
repositories {
mavenRepo urls: "f:/dev/lib/"
}
dependencies {
groovy group: 'org.codehaus.groovy', name: 'groovy-all', version: '1.7.5'
compile 'log4j:log4j:1.2.14',
'com.caucho:hessian:4.0.7',
'com.toedter:jcalendar:1.3.2',
'org.springframework:spring-context-support:3.0.5.RELEASE',
'org.springframework:spring-web:3.0.5.RELEASE',
'com.jgoodies:looks:2.2.2',
'com.jgoodies:animation:1.2.0',
'com.jgoodies:binding:2.0.6',
'com.jgoodies:forms:1.2.1',
'com.jgoodies:validation:2.0.1'
testCompile 'junit:junit:4.7',
'org.unitils:unitils-spring:3.1',
'org.unitils:unitils-easymock:3.1',
'org.unitils:unitils-inject:3.1',
'org.springframework:spring-test:3.0.5.RELEASE'
}
manifest.mainAttributes(
'Implementation-Title': 'victoria',
'Implementation-Version': version,
'Main-Class': 'com.sirius.opas.client.Client',
'Class-Path':manifestClasspath() )
task release(dependsOn: 'jar') << {
ant.delete(dir:releaseDir, quiet:"true" )
ant.mkdir(dir:releaseDir)
copy {
from configurations.compile
into "${releaseDir}/${releaseLibDir}"
}
copy {
from "$libsDir/${archivesBaseName}-${version}.jar"
from "dist/start.sh"
from "dist/start.cmd"
into "${releaseDir}"
}
}
String manifestClasspath() {
String classes = ""
configurations.compile.files.each { file ->
classes += " ${releaseLibDir}/${file.name}"
}
return classes
}
I think you are simply missing a dependency that provides BeanDefinition class. Try adding 'org.springframework:spring-beans:3.0.5.RELEASE' to your compile dependencies list.