In shell I typed gradle cleanJar in the Impatient/part1 directory. The output is below. The error is "class file for org.apache.hadoop.mapred.JobConf not found". Why did it fail to compile?
:clean UP-TO-DATE
:compileJava
Download http://conjars.org/repo/cascading/cascading-core/2.0.1/cascading-core-2.0.1.pom
Download http://conjars.org/repo/cascading/cascading-hadoop/2.0.1/cascading-hadoop-2.0.1.pom
Download http://conjars.org/repo/riffle/riffle/0.1-dev/riffle-0.1-dev.pom
Download http://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.pom
Download http://repo1.maven.org/maven2/org/slf4j/slf4j-parent/1.6.1/slf4j-parent-1.6.1.pom
Download http://repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.pom
Download http://conjars.org/repo/thirdparty/jgrapht-jdk1.6/0.8.1/jgrapht-jdk1.6-0.8.1.pom
Download http://repo1.maven.org/maven2/org/codehaus/janino/janino/2.5.16/janino-2.5.16.pom
Download http://conjars.org/repo/cascading/cascading-core/2.0.1/cascading-core-2.0.1.jar
Download http://conjars.org/repo/cascading/cascading-hadoop/2.0.1/cascading-hadoop-2.0.1.jar
Download http://conjars.org/repo/riffle/riffle/0.1-dev/riffle-0.1-dev.jar
Download http://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar
Download http://repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar
Download http://conjars.org/repo/thirdparty/jgrapht-jdk1.6/0.8.1/jgrapht-jdk1.6-0.8.1.jar
Download http://repo1.maven.org/maven2/org/codehaus/janino/janino/2.5.16/janino-2.5.16.jar
/home/is_admin/lab/cascading/Impatient/part1/src/main/java/impatient/Main.java:50: error: cannot access JobConf
Tap inTap = new Hfs( new TextDelimited( true, "\t" ), inPath );
^
class file for org.apache.hadoop.mapred.JobConf not found
1 error
:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 22.599 secs
try using Java 6 , gradle has some known issues with java 7
Add hadoop-core-1.x.y.jar from hadoop distribution to path.
This worked for me in CoPA example. I added to eclipse build path.
Add this to gradle dependencies{} section
compile( group: 'org.apache.hadoop', name: 'hadoop-core', version: '1.2.0' )
It seems like class not found, please check libraries in build path entries.
I had the same issue today trying the Cascading for the Impatient tutorial. I have solved adding the following to my build.gradle in the dependenciessection :
compile 'org.apache.hadoop:hadoop-client:2.3.0'
I wanted to use Hadoop 2.3.0, but I guess that you can choose your own version of Hadoop.
PS : In order to use the first hadoop-mapred package, you have to add the following instead :
compile 'org.apache.hadoop:hadoop-mapred:0.22.0'
You can find all the repos you might need for Hadoop here.
Thanks Lalit,
Adding the below line did the trick for me without have to change any java version..
compile( group: 'org.apache.hadoop', name: 'hadoop-core', version: '1.2.0' )
Alternatively, I can even add the hadoop-core jar in the class path and mention that in the gradle path
Related
I want to using GraalVM in my Spring Boot 2.3.10.RELEASE project because it can decrease the memory usage of JVM(Now I am using JDK 11), so I add the dependencies:
api "org.springframework.experimental:spring-native:0.10.2"
add the gradle plugin:
apply plugin: "com.github.ayltai.spring-graalvm-native-plugin"
add native build config:
nativeImage {
mainClassName = 'com.dolphin.soa.manage.AppStarter'
traceClassInitialization = true
reportExceptionStackTraces = true
removeUnusedAutoConfig = true
removeYamlSupport = true
removeSpelSupport = true
removeJmxSupport = true
maxHeapSize = '4G'
}
finnaly I am using this Gradle(7.0) command to build a native jar:
./gradlew clean :dolphin-manage:dolphin-manage-service:bootBuildImage -x test
but show this error:
> Configure project :dolphin-acientbay
/Users/dolphin/source/retire
> Configure project :dolphin-post
/Users/dolphin/source/retire
> Configure project :dolphin-template
/Users/dolphin/source/retire
> Task :dolphin-common:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dolphin-common:compileJava'.
> java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module #0x2155f75f) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module #0x2155f75f
* 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 6m 49s
5 actionable tasks: 1 executed, 4 up-to-date
(base)
is it a compatible problem about GraalVM and lombok? is it possible to fix it?
I'm seeing this same type of error running spotless on my Java project. I just reported a bug about this to them: https://github.com/diffplug/spotless/issues/1244
I diagnosed the problem as some kind behavioral change between Java 15 and Java 16. So one thing you can do is revert to an earlier version of Java to see if that makes the issue go away. If it does, you should report a bug similar to what I did to the project with the problem so they can try to fix it.
This is the error I get from the console of the program and it won't let me even import the gradle to Eclipse
Generating app in C:\Users\mrgnh\Desktop\libGDXstuff
Executing 'C:\Users\mrgnh\Desktop\libGDXstuff/gradlew.bat clean --no-daemon'
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/6.7.1/userguide/gradle_daemon.html.
Daemon will be stopped at the end of the build stopping after processing
FAILURE: Build failed with an exception.
Where:
Settings file 'C:\Users\mrgnh\Desktop\libGDXstuff\settings.gradle'
What went wrong:
Could not compile settings file 'C:\Users\mrgnh\Desktop\libGDXstuff\settings.gradle'.
startup failed:
General error during semantic analysis: Unsupported class file major version 60
It turns out I am blind and that libGDX does not support JDK 16 only 8-15
So when creating the gradle with the JDK 16 gradle System it wasn't working out
Try to change to latest gradle website version of gradle in file: Gradle -> Wrapper -> gradle-wrapper.properties
It helped me.
My build.gradle file:
//Hibernate
implementation 'org.hibernate:hibernate-core:5.4.2.Final'
implementation 'org.hibernate:hibernate-entitymanager:5.4.2.Final'
//Hibernate Search
implementation 'org.hibernate:hibernate-search:5.11.1.Final'
implementation 'org.hibernate:hibernate-annotations:3.5.6-Final'
implementation 'org.apache.solr:solr-common:1.3.0'
implementation 'org.apache.solr:solr-core:7.6.0'
implementation 'org.lucee:lucene-snowball:2.9.4'
When I ran ./gradlew clean jar in IntelliJ, I've got the error:
12:40:34: Executing task 'jar'...
Task :wrapper
BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed
Task :compileJava FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':compileJava'.
Could not resolve all files for configuration ':compileClasspath'.
Could not find org.restlet.jee:org.restlet:2.3.0.
Required by:
project : > org.apache.solr:solr-core:7.6.0
Could not find org.restlet.jee:org.restlet.ext.servlet:2.3.0.
Required by:
project : > org.apache.solr:solr-core:7.6.0
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 3s
1 actionable task: 1 executed
Could not find org.restlet.jee:org.restlet:2.3.0.
Required by:
project : > org.apache.solr:solr-core:7.6.0
Search in build.gradle files
12:40:38: Task execution finished 'jar'.
Solr is not necessary to use Hibernate Search. Try removing the Solr dependencies.
If you added these dependencies to use extra analyzers, you may want to know that in the past few years most analyzers were moved from Solr to Lucene, and thus you should be able to depend on Lucene jars instead: see here
I have been trying to do CI using Jenkins for my Android application. I am new to this. After following some of the tutorials, I am able to atleast set up and run the build now option. It download every pom required but while building it give below error.
============================================
C:\Windows\System32\config\systemprofile.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\e796469c387c11565d873216f24c3b6f\res\drawable\abc_ic_go_search_api_material.xml: error: file not found.
C:\Windows\System32\config\systemprofile.gradle\caches\transforms-1\files-1.1\play-services-base-15.0.1.aar\7207fbd3bdb6cb696445cfc77c16e5ed\res\drawable-hdpi-v4\googleg_standard_color_18.png: error: file not found.
C:\Windows\System32\config\systemprofile.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\e796469c387c11565d873216f24c3b6f\res\layout\select_dialog_singlechoice_material.xml: error: file not found.
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
:app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
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.
======================================================
Can you please let me know how to resolve it?
Do let me know if anything else is required.
Maybe the path is too long. Try this:
Jenkins --> Project --> Project Configuration --> Build
Select advanced option
Check the option box "Force GRADLE_USER_HOME to use workspace"
Build your project
I solved my problem by this way, good luck!
Try updating your android gradle plugin version to 3.2.0-alpha12 or newer. AAPT2's version included in these versions contains many fixes for path support on Windows which resulted in similar errors.
you can solve this by separating into smaller group of task
make separate invoke gradle script under build tab
clean build assembleDebug
test
connectedAndroidTest
i had similar issues, when i ran assembleDebug and test together in Jenkins as a single task
When using Jenkins with Window to build Android, I face this problem myself.
I fix by add GRADLE_USER_HOME to Environment Variable:
GRADLE_USER_HOME = C:\Users\*MyUserName*\.gradle
hope this help,
Gradle throws a NoClassDefFoundError when trying to execute a grgit task.
Start of build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'org.ajoberstar:gradle-git:1.2.0'
}
}
apply plugin: 'com.android.application'
//
//
import org.ajoberstar.grgit.*
task clone << {
File dir = new File('contrib/otherstuff')
if(!dir.exists()) {
def grgit = Grgit.clone(dir: dir, uri: 'https://github.com/someguy/otherstuff.git')
}
// TODO else (pull)
}
project.afterEvaluate {
preBuild.dependsOn clone
}
// rest omitted
Output:
Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0
:src:myproject:clone FAILED
FAILURE: Build failed with an exception.
* Where:
Build file '/home/me/src/myproject/build.gradle' line: 20
* What went wrong:
Execution failed for task ':src:myproject:clone'.
> java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 16.937 secs
Line 20 is the call to Grgit.clone().
Do I need to add groovy as a build dependency (which the error message seems to indicate)? How and where would I add it?
EDIT: gradle version is 1.10, if it matters.
As #user149408 pointed out the Gradle version (v1.10 vs v2.10) mismatch, I dug a little bit further:
gradle-git-plugin commit for v0.7.0 specifies the Gradle version used (v1.11), so the build with v1.10 works fine.
Because the Gradle plugin always built with compile localGroovy() and compile gradleApi() which comes from Gradle, then if it builds with Gradle 2.x, it would incur the Groovy mismatch error.
What went wrong: Execution failed for task ':src:myproject:clone'.
java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling
In fact, the combo of Gradle v2.10 and gradle-git v1.2.0 just works fine.
Some sample build.gradle similar structure as in the question.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.ajoberstar:gradle-git:1.2.0'
}
}
import org.ajoberstar.grgit.*
task clone << {
File dir = new File('contrib/gs-spring-boot')
if(!dir.exists()) {
def grgit = Grgit.clone(dir: dir, uri: 'https://github.com/chenrui333/gs-spring-boot.git')
}
// TODO else (pull)
}
./gradlew clone would give you:
$ ls contrib/gs-spring-boot/
CONTRIBUTING.adoc LICENSE.code.txt LICENSE.writing.txt README.adoc complete initial test
Hope it helps!
I’ve managed to solve it.
grgit-1.2.0 appears to depend on groovy. Adding a classpath entry for groovy in the buildscript/dependencies block resulted in a different error:
Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0
:src:myproject:clone FAILED
FAILURE: Build failed with an exception.
* Where:
Build file '/home/me/src/myproject/build.gradle' line: 23
* What went wrong:
Execution failed for task ':src:myproject:clone'.
> java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for org.ajoberstar.grgit.auth.AuthConfig$Option do not match. Expected -1 but got 2
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 12.295 secs
Further research revealed that this might stem from a version incompatibility (as I’m stuck with Gradle 1.10 for other reasons).
Eventually I solved it by going back to grgit-0.7.0. Now my git task works and the repo gets cloned.