代码拉取完成,页面将自动刷新
LogTrace插件,用AspectJ切入log,
...
@LogTrace(level = 2)
public int add3(int a) {
return a + 3;
}
...
结果如下:
DEBUG: Test01: ⇢ add3(a=7) [Thread:"main"] DEBUG: Test01: ⇠ add3 [0ms] = 10
运行gradle -b LogTrace-Plugin/deploy.gradle uploadArchives 发布
apply plugin: 'logtrace'
buildscript {
dependencies {
classpath group: 'com.logtrace', name: 'LogTrace-Plugin', version: '1.0-SNAPSHOT'
}
}
dependencies {
compile group: 'com.logtrace', name: 'LogTrace-Plugin', version: '1.0-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
logtrace {
enabled = true
compileJavas = [compileJava]
compileTestJavas = [compileJava, compileTestJava]
}
apply plugin: 'java'
apply plugin: 'logtrace'
sourceCompatibility = 1.8
targetCompatibility = 1.8
buildscript {
repositories {
jcenter()
maven {url "https://raw.github.com/ttt307307/mvn-repo/master/"}
}
dependencies {
classpath group: 'com.logtrace', name: 'LogTrace-Plugin', version: '1.0-SNAPSHOT'
}
}
allprojects {
repositories {
jcenter()
maven {url "https://raw.github.com/ttt307307/mvn-repo/master/"}
}
}
logtrace {
enabled = true
compileJavas = [compileJava]
compileTestJavas = [compileTestJava]
}
sourceSets {
main {
java {
srcDirs = ['src/main/java']
}
resources {
srcDirs = ['src/main/resources']
}
}
test {
java {
srcDirs = ['src/junit/java','src/testng/java']
}
resources {
srcDirs = ['src/junit/resources']
}
}
}
dependencies {
compile group: 'com.logtrace', name: 'LogTrace-Plugin', version: '1.0-SNAPSHOT'
testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile group: 'org.testng', name: 'testng', version: '6.9.9'
testCompile 'org.mockito:mockito-core:1.10.19'
}
Java工程参考 LogTraceDemo 和 LogTraceDemo-Remote-Repo
sourceCompatibility = 1.8
targetCompatibility = 1.8
buildscript {
repositories {
jcenter()
mavenCentral()
}
repositories {
flatDir {
name 'localRepository'
}
}
repositories {
localRepository {
dirs '../local-repo'
}
}
dependencies {
classpath group: 'com.logtrace', name: 'LogTrace-Plugin', version: '1.0-SNAPSHOT'
}
}
allprojects {
repositories {
jcenter()
flatDir {
name 'localRepository'
}
localRepository {
dirs '../local-repo'
}
}
}
logtrace {
enabled = true
compileJavas = [compileJava]
compileTestJavas = [compileJava, compileTestJava]
}
Android工程参考 logtracedemo-and
apply plugin: 'com.android.application'
apply plugin: 'logtrace'
sourceCompatibility = 1.7
targetCompatibility = 1.7
buildscript {
repositories {
jcenter()
mavenCentral()
}
repositories {
flatDir {
name 'localRepository'
}
}
repositories {
localRepository {
dirs '../local-repo'
}
}
dependencies {
classpath group: 'com.logtrace', name: 'LogTrace-Plugin', version: '1.0-SNAPSHOT'
}
}
allprojects {
repositories {
jcenter()
flatDir {
name 'localRepository'
}
localRepository {
dirs '../local-repo'
}
}
}
logtrace {
enabled = true
}
//Application
project.android.applicationVariants.all { variant ->
variant.each {
logtrace.compileJavas.add(variant.javaCompile)
}
}
//如果是Library
//project.android.libraryVariants.all { variant ->
// variant.each {
// logtrace.compileJavas.add(variant.javaCompile)
// }
//}
project.android.testVariants.all { variant ->
variant.each {
logtrace.compileTestJavas.add(variant.javaCompile)
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。