Gradle notes

Use the local Maven repository

1
2
3
4
5
6
7
8
9
10
11
12
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
// maven {
// url 'http://m2.objectdb.com'
// }
mavenLocal()
mavenCentral()


}
1
2
3
4
dependencies {
//.......
compile 'net.stihie:llm:0.1'
}

gradle build –refresh-dependencies

Include other jars in the dependencies. Define the variable extraLibs

1
2
3
configurations {
extraLibs
}

In the dependencies, add the jars to extraLibs:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

dependencies {
// This dependency is found on compile classpath of this component and consumers.
compile 'com.google.guava:guava:23.0'
extraLibs group: 'com.google.guava', name: 'guava', version: '23.0'

extraLibs group: 'org.postgresql', name: 'postgresql', version: '42.2.5'
configurations.compile.extendsFrom(configurations.extraLibs)
// Use JUnit test framework
testCompile 'junit:junit:4.12'
//compile files("objectdb-2.7.5/bin/converter.jar")

// PostgreSQL:
compile(group: 'org.postgresql', name: 'postgresql', version: '42.2.5')
implementation(group: 'org.postgresql', name: 'postgresql', version: '42.2.5')
//Help system
// compile 'javax.help:javahelp:2.0.05'
// implementation 'javax.help:javahelp:2.0.05'
compile 'javax.swing:jlfgr:1.0'
implementation 'javax.swing:jlfgr:1.0'
extraLibs group: 'javax.swing', name: 'jlfgr', version: '1.0'

// compile 'net.stihie:bllm:0.1'
// implementation 'net.stihie:bllm:0.1'
// compile 'javax.swing:jnlp:1.0'
// implementation 'javax.swing:jnlp:1.0'

//JSON parsing
compile 'com.google.code.gson:gson:2.8.5'

//QR code library
// compile 'com.google.zxing:core:3.3.3'
// implementation 'com.google.zxing:core:3.3.3'
// compile 'com.google.zxing:javase:3.3.3'
// implementation 'com.google.zxing:javase:3.3.3'

}

Show contents of the cache:

1
2
3
4
task showMeCache doLast{
configurations.compile.each { println it }
}

1
2
3
4
5
task refreshLicense(type: Copy) {
from("/home/mbc/LitecoinLicenses/license/DkFzn23a")
into(".")
include("*.ser")
}
1
2
3
task myJavadocs(type: Javadoc) {
source = sourceSets.main.allJava
}
1
2
3
4
5
6
7
8
task copyJavaDocsToWeb(type: Copy, dependsOn: [myJavadocs]) {
// from configurations.runtime
from("build/docs/.")
into("/home/mbc/pm/public")
include('*.html', '*.js', '*.js')
include('javadoc/**')

}

task getDeps(type: Exec) {
configurations.testRuntime.files
commandLine ‘echo’, ‘Downloaded all dependencies’
}

//update the local Maven repository
task updateMaven(type: Exec) {

executable "mvn"
args "install:install-file", "-Dfile=/home/mbc/Downloads/postgresql-42.2.5.jar", "-DgroupId=org.postgresql", "-DartifactId=postgresql", "-Dversion=42.2.5", "-Dpackaging=jar"

// args “install:install-file”, “-Dfile=/home/mbc/Downloads/poi-bin-4.0.1-20181203/poi-4.0.1/poi-ooxml-4.0.1.jar”, “-DgroupId=org.apache”, “-DartifactId=poi-ooxml”, “-Dversion=4.0.1”, “-Dpackaging=jar”

// args “install:install-file”, “-Dfile=build/libs/pm-0.1.jar”, “-DgroupId=net.stihie”, “-DartifactId=pm”, “-Dversion=0.1”, “-Dpackaging=jar”

}

task makeHelp(type: Copy, dependsOn: [copyJavaDocsToWeb, copySchemaDocsToWeb]){

}

task getDeps(type: Exec) {
configurations.testRuntime.files
commandLine ‘echo’, ‘Downloaded all dependencies’
}

//update the local Maven repository
task updateMaven(type: Exec) {

executable "mvn"
args "install:install-file", "-Dfile=/home/mbc/Downloads/postgresql-42.2.5.jar", "-DgroupId=org.postgresql", "-DartifactId=postgresql", "-Dversion=42.2.5", "-Dpackaging=jar"

// args “install:install-file”, “-Dfile=/home/mbc/Downloads/poi-bin-4.0.1-20181203/poi-4.0.1/poi-ooxml-4.0.1.jar”, “-DgroupId=org.apache”, “-DartifactId=poi-ooxml”, “-Dversion=4.0.1”, “-Dpackaging=jar”

// args “install:install-file”, “-Dfile=build/libs/pm-0.1.jar”, “-DgroupId=net.stihie”, “-DartifactId=pm”, “-Dversion=0.1”, “-Dpackaging=jar”

}

1
2
3
4
5
6
7
8
task initializePostgres(type:Exec) {

executable '/usr/bin/psql -U postgres -h 192.168.1.11'
args '-f ~/syncd/prog/plate-manager/pm/postgres/create_tables.sql'
outputs.upToDateWhen { false }


}
1
2
3
4
5
6
7
task refreshLicense(type: Copy) {
from("/home/mbc/LitecoinLicenses/license/DkFzn23a")
into(".")
include("*.ser")
}


JavaDocs and Schema

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
task myJavadocs(type: Javadoc) {
source = sourceSets.main.allJava
}


task copyJavaDocsToWeb(type: Copy, dependsOn: [myJavadocs]) {
// from configurations.runtime
from("build/docs/.")
into("/home/mbc/syncd/labsolns/public")
include('*.html', '*.js', '*.js')
include('javadoc/**')

}


task getSchema(type: JavaExec) {
main = "-jar";
args "/home/mbc/temp/schemaspy/schemaspy-6.1.0-SNAPSHOT.jar","-configFile", "/home/mbc/temp/schemaspy/schemaspy.properties","-dp","/home/mbc/temp/schemaspy/postgresql-42.2.5.jar"
}

task copySchemaDocsToWeb(type: Copy, dependsOn: [getSchema]) {
// from configurations.runtime
from("./output")
// include('*.html', '*.js', '*.css','*.png','*.txt','*.xml')
into("/home/mbc/syncd/labsolns/public/schema")


}

task makeHelp(type: Copy, dependsOn: [copyJavaDocsToWeb, copySchemaDocsToWeb]){

Prep the development environment

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
task prep {
doLast{

exec{
commandLine 'git', 'pull'
}
exec{
workingDir '../postgres'
commandLine 'git', 'pull'

}
exec{
workingDir '/home/mbc'
// commandLine 'gnome-terminal psql -U pm_admin -h 192.168.1.7 -d pmdb'
commandLine 'gnome-terminal', '--command=/usr/bin/psql -U ln_admin -h 192.168.1.11 -d lndb'
}
//exec{
// workingDir '/home/mbc'
// commandLine 'psql','-Upm_admin', '-h192.168.1.7', '-dpmdb'
//}
exec{
commandLine 'gnome-terminal','--command=emacs'
}

}

}

Share