java - Importing gradle dependencies -


i'm editing open source package uses gradle building/dependency management. have not used gradle before.

i wanted use few jackson methods, added compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.7.5' build.gradle file , added import com.fasterxml.jackson.*; project.

but when try build ./gradle shadowjar, following error:

installing pre-commit hook unix/os x warning: jar not create executable jar. use shadowjar instead. :compilejava /users/mttjone/sw/builds/bixie-vanilla/src/main/java/bixie/checker/reportprinter/jsonreportprinter.java:11: error: package com.fasterxml.jackson not exist import com.fasterxml.jackson.*; ^  ...  4 errors :compilejava failed  failure: build failed exception.  * went wrong: execution failed task ':compilejava'. > compilation failed; see compiler error output details.  * try: run --stacktrace option stack trace. run --info or --debug option more log output.  build failed 

by popular demand:

if(javaversion.current() < javaversion.version_1_7){     println("\t************************")     println("\t*** hello bixie ***")     println("\tyou need java 1.7 or higher if want continue.")     println("\tyour java old. found version " + javaversion.current())     println("\t************************")     throw new gradleexception("update java!")     }  import org.apache.tools.ant.taskdefs.condition.os  //install commit hook if possible. def hook_folder = new file('./.git/hooks') def hook = new file('pre-commit.sh') def installed_hook = new file('./.git/hooks/pre-commit')  if (os.isfamily(os.family_windows)) {  println("installing pre-commit hook windows")  if (hook.exists() && hook_folder.exists() && !installed_hook.exists()) {   exec {    commandline 'cmd', '/c', 'copy', hook.getabsolutepath(), installed_hook.getabsolutepath()   }    } } else {  println("installing pre-commit hook unix/os x")  if (hook.exists() && hook_folder.exists() && !installed_hook.exists()) {   exec {    workingdir '.'    commandline 'cp', hook, installed_hook   }    }  }   apply plugin: 'java' apply plugin: 'eclipse-wtp' apply plugin: 'idea' apply plugin: 'jacoco' apply plugin: 'com.github.kt3k.coveralls' apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'application' apply plugin: 'findbugs' //apply plugin: 'jdepend'   apply plugin: 'checkstyle'  task wrapper(type: wrapper) {     gradleversion = '2.3' }   def version = '1.0' jar.archivename = "bixie_dyn.jar" shadowjar.archivename = "bixie.jar" mainclassname = "bixie.main"  repositories {   mavencentral() }  buildscript {     repositories {         mavencentral()         maven {             name 'shadow'             url "https://plugins.gradle.org/m2/"         }     }      dependencies {         classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1'         classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.2'     } }  configurations{   common }  dependencies {     compile 'args4j:args4j:2.32'         compile 'log4j:log4j:1.2.17'     compile 'org.scala-lang:scala-actors:2.11.7'     compile 'org.scala-lang:scala-library:2.11.7'     compile 'com.googlecode.json-simple:json-simple:1.1.1'     compile 'net.sourceforge.findbugs:annotations:1.3.2'     compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.7.5'      compile filetree(dir: 'lib', include: '*.jar')         testcompile "junit:junit:4.11"  // or whatever version }   // building jar ---------------------  jar {   println("warning: jar not create executable jar. use shadowjar instead.")     basename = 'bixie'      configurations.compile.collect { it.isdirectory() ? : ziptree(it) }      from('src/main/resources'){ include('log4j.properties')}     from('src/main/resources'){ include('basic_prelude.bpl')}     from('src/main/resources'){ include('java_lang.bpl')}        manifest {         attributes 'main-class': mainclassname,                    'class-path': '.',                    'implementation-title': 'bixie',                    'implementation-version': version     } }  shadowjar {     append('src/main/resources/report_html.zip') }   //jar.dependson shadowjar  // testing related activities ----------------- tasks.withtype(findbugs) {     effort = "max"     reportlevel = "medium"      findbugs.excludefilter = file("$rootproject.projectdir/config/findbugs/excludefilter.xml")      reports {         xml.enabled = false         html.enabled = true     }  }    jacocotestreport {     reports {         xml.enabled true         html.enabled true         csv.enabled false         html.destination "${builddir}/reports/coverage"     } }  test {   jacoco {     enabled = true   }      testlogging {         events "failed"         exceptionformat "full"     }      usejunit() }  task selfcheck {   group 'verification'   description 'run bixie on itself.'    dolast {     def bixiejar = shadowjar.archivepath     def bixiedir = compilejava.destinationdir     def bixieclasspath = compilejava.classpath.aspath     //todo generate this.     def bixiereportdir = "${builddir}/reports/self_test.txt"      exec {         workingdir '.'         commandline 'java', '-jar', bixiejar, '-j', bixiedir, '-cp', bixieclasspath, '-o', bixiereportdir, '-checker', '3'     }    } }  task infercheck {   group 'verification'   description 'run facebook infer on project.'    dolast {     println("requires infer in path.")      exec {         workingdir '.'         commandline 'infer', '--', 'gradle', 'clean', 'compilejava'     }    } } 

relevant bit of gradle dependencies:

runtime - runtime classpath source set 'main'. +--- args4j:args4j:2.32 +--- log4j:log4j:1.2.17 +--- org.scala-lang:scala-actors:2.11.7 |    \--- org.scala-lang:scala-library:2.11.7 +--- org.scala-lang:scala-library:2.11.7 +--- com.googlecode.json-simple:json-simple:1.1.1 |    \--- junit:junit:4.10 |         \--- org.hamcrest:hamcrest-core:1.1 +--- net.sourceforge.findbugs:annotations:1.3.2 \--- com.fasterxml.jackson.core:jackson-databind:2.7.5      +--- com.fasterxml.jackson.core:jackson-annotations:2.7.0      \--- com.fasterxml.jackson.core:jackson-core:2.7.5 

i think question has nothing gradle getting code corrected.

does package com.fasterxml.jackson exist?
note, package com.fasterxml.jackson.databind or com.fasterxml.jackson.core exist says nothing package com.fasterxml.jackson. 3 packages absolutely unrelated , standalone. there no such thing "sub-package".


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -