Building Java projects
satya - 7/14/2018, 5:47:05 PM
A quick start document for Java projects
satya - 3/19/2019, 6:47:57 PM
variable names in groovy doesn't seem to allow hyphens
//following is wrong
some-var
//use
someVar
satya - 3/19/2019, 7:07:13 PM
Simple mistakes
//This is correct
ext {
hadoopgroup = 'org.apache.hadoop'
hadoopname = 'hadoop-core'
hadoopversion = '1.2.1'
hadoopdependency="${hadoopgroup}:${hadoopname}:${hadoopversion}"
guavadependency= 'com.google.guava:guava:27.0.1-jre'
}
//This is wrong
ext {
hadoopgroup = 'org.apache.hadoop'
hadoopname = 'hadoop-core'
hadoopversion = '1.2.1'
hadoopdependency="$(hadoopgroup):$(hadoopname):$(hadoopversion)"
guavadependency= 'com.google.guava:guava:27.0.1-jre'
}
Notice the "()" vs "{}"
satya - 3/19/2019, 7:09:36 PM
How do I start a build using gradle plugin in eclipse?
How do I start a build using gradle plugin in eclipse?
Search for: How do I start a build using gradle plugin in eclipse?
satya - 3/19/2019, 7:12:11 PM
Here is what you do
Go to Gradle tasks tab near the console
Locate build
Locate the assemble task
right click
Run the task
satya - 3/19/2019, 7:12:37 PM
You will see in console something like this
> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes
> Task :jar
> Task :assemble
BUILD SUCCESSFUL in 3s
3 actionable tasks: 3 executed
satya - 3/19/2019, 7:16:39 PM
Here are some tests I was running to play with the build file
plugins {
id 'java'
}
ext {
hadoopgroup = 'org.apache.hadoop'
hadoopname = 'hadoop-core'
hadoopversion = '1.2.1'
hadoopdependency="${hadoopgroup}:${hadoopname}:${hadoopversion}"
guavadependency= 'com.google.guava:guava:27.0.1-jre'
}
repositories {
jcenter()
}
dependencies {
//implementation '$(hadoop-dependency);$(guava-dependency)'
// Use JUnit test framework
//testImplementation 'junit:junit:4.12'
}
task testTask {
println 'test task configuration'
println hadoopdependency
println tasks
doLast {
println 'test task execution. changed';
}
}
assemble {
dependsOn testTask
}
satya - 3/19/2019, 7:25:09 PM
Better way to say the implementation
//correct, assuming hadoopdependency is initialized as a string
implementation hadoopdependency
//this is equivalent to
implementation(hadoopdependency)
//wrong
implementation '${hadoopdependency}'
//May the $ sign is valid only in string initializaitons
satya - 3/19/2019, 7:26:19 PM
Wonder where Gradle keeps the downloaded dependency jar files
Wonder where Gradle keeps the downloaded dependency jar files
Search for: Wonder where Gradle keeps the downloaded dependency jar files
satya - 3/20/2019, 9:52:47 AM
Here is an overview of using the Gradle Plugin: Vogella.com
satya - 3/20/2019, 9:54:12 AM
What is Refresh Gradle Project in eclipse?
What is Refresh Gradle Project in eclipse?
satya - 3/20/2019, 10:46:58 AM
Refresh Gradle Project
Right click and look for this menu item under "Gradle"
This menu item will, not sure what else it does, but will download the dependencies into the Gradle installation cache directory and attaches them as external libraries to the eclipse project.
satya - 3/20/2019, 10:57:47 AM
What is the default gradle convention for java source files?
/srs/main/java
..../com.ai.learning.bigdata.mapreduce
satya - 3/20/2019, 5:06:32 PM
Next question comes where and what are the output directories for java gradle plugin
Next question comes where and what are the output directories for java gradle plugin
Search for: Next question comes where and what are the output directories for java gradle plugin
satya - 3/20/2019, 5:07:06 PM
Javaplugin is again for a quick ref is here
satya - 3/20/2019, 5:14:43 PM
Here is another key read for building java projects
satya - 3/20/2019, 5:21:22 PM
what is $buildDir in gradle?
what is $buildDir in gradle?
satya - 3/20/2019, 5:23:06 PM
Interesting that definition is sitting on the Project class. See the docs here
Interesting that definition is sitting on the Project class. See the docs here
satya - 3/20/2019, 5:23:32 PM
The default build directory is
projectDir/build
satya - 3/20/2019, 5:25:42 PM
The task "clean" will delete the build directory
You have to press F5 to refresh the eclipse IDE to see the build directory gone.
satya - 3/20/2019, 6:22:07 PM
Here is the build.gradle that worked
plugins {
id 'java'
}
ext {
hadoopgroup = 'org.apache.hadoop'
hadoopname = 'hadoop-core'
hadoopversion = '1.2.1'
hadoopdependency="${hadoopgroup}:${hadoopname}:${hadoopversion}"
}
repositories {
jcenter()
}
dependencies {
implementation hadoopdependency
}
task testTask {
println 'test task configuration'
println hadoopdependency
println tasks
doLast {
println 'test task execution. changed';
}
}
assemble {
dependsOn testTask
}
There are some testing lines in there. the testTask for example. You can delete that.
satya - 3/20/2019, 6:23:25 PM
is there a way to run MapReduce in Eclipse without installing HadoopCore?
is there a way to run MapReduce in Eclipse without installing HadoopCore?
Search for: is there a way to run MapReduce in Eclipse without installing HadoopCore?