我是java/gradle安装的新手,并且能够使用此处提供的示例构建jar文件.同时也实现了Jacoco代码覆盖工具.
但遇到以下问题
无法构建RPM,Tried ospackage-plugin但它只是不生成任何东西(在插件的github页面上提供的示例)
Jacoco没有生成突出显示的源代码html文件?它的产生,直到像法击穿这个,但不能产生单独的源代码文件
我的build.gradle文件如下
plugins { id "nebula.ospackage" version "3.2.0" } apply plugin: 'nebula.ospackage' apply plugin: 'java' apply plugin: "jacoco" repositories { mavenCentral() jcenter() } dependencies { testCompile 'org.testng:testng:6.8' compile 'log4j:log4j:1.2.17' } sourceSets { main { java { srcDir 'src/main/java/' } resources { srcDir 'src/main/resources' } } test { java { srcDir 'src/test/java/' } resources { srcDir 'src/test/resources' } } } test { // explicitly include or exclude tests include 'src/test/java/**' useTestNG{ useDefaultListeners = true } jacoco { append = false destinationFile = file("$buildDir/jacoco/jacocoTest.exec") classDumpFile = file("$buildDir/jacoco/classpathdumps") } finalizedBy jacocoTestReport } jacocoTestReport { reports { xml.enabled false csv.enabled false html.enabled true html.destination "${buildDir}/jacocoHtml" } } jar { baseName = 'smith' version = '1.0' manifest { attributes 'Main-Class': 'src.main.java.HelloWorld '} } ospackage { packageName = 'foo' version = '1.2.3' release = '1' arch = I386 os = LINUX } // buildRpm and buildDeb are implicitly created, but can still be configured if needed buildRpm { arch = I386 }
STDOUT如下
project]$ /opt/gradle/bin/gradle build :compileJava :processResources UP-TO-DATE :classes :jar :assemble :compileTestJava :processTestResources :testClasses :test :jacocoTestReport :check :build BUILD SUCCESSFUL Total time: 11.258 secs This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.9/userguide/gradle_daemon.html
任何我上面忽略的指针都将受到高度赞赏.如果不遵守任何标准/惯例,也请随时告诉我
谢谢
您需要运行该buildRpm
任务.
gradle buildRpm
如果您希望在运行时运行此任务,gradle build
只需在build.gradle文件中配置依赖项
build.dependsOn buildRpm