Setting .gradle not executing

gradle-3413
issue-acknowledged

(selvarajchennappan) #1

I have code_quality.gradle and settings.gradle
When I run gradle -b code_quality.gradle -c settings.gradle

Sub projects are not executing/applying which I configured in setting.gradle
if I change file name code_quality.gradle to build.gradle
it is working as expected .
What is problem with filename ?
how ever I have already build.gradle file creating ear.

Gradle Version : 2.4


(René Groeschke) #2

I can reproduce this issue and raised GRADLE-3413 for this.


(René Groeschke) #3

as a workaround, you can add the following snippet to your settings.gradle file

if(gradle.startParameter.buildFile){
    project(':').buildFileName = gradle.startParameter.buildFile.name    
}

(selvarajchennappan) #4

Thank you Rene.
however ,Pmd,findbug is not invoked .

Gradle Code
apply plugin: ‘java’

subprojects
{
apply plugin: “java"
apply plugin: 'pmd’
apply plugin: 'findbugs’
apply plugin: ‘checkstyle’
repositories {
mavenCentral()
}
dependencies
{
compile fileTree(include: [”**/*.jar"], dir: “$projectlibDir”)

}

sourceSets 
{
   	main 
   	{
      java {
        srcDir "$projectBaseDir/$project.name/src"
       }
	  resources {
		srcDir "$projectBaseDir/$project.name/src/main/resources"
	  }
  	}
}

pmd {
	toolVersion = "5.4.0"
	//reportsDir = file("$codeQualityReportsDir/pmdReports")
	ignoreFailures = true
}
	
pmdMain {
	reports {
		xml.enabled false
		html.enabled true
	}
}

findbugs {
	toolVersion = "3.0.1"
	effort = "max"
	reportLevel = "low"
	ignoreFailures = true
}

findbugsMain {
	reports {
		xml.enabled = false
		html.enabled = true
	}
}


checkstyle {
	configFile = new File(rootDir, "../code_quality/checkstyle/checkstyle.xml")
	reportsDir = file("$codeQualityReportsDir/checkstyle")
	ignoreFailures = true
}

check << {
	File outDir = new File("$project.buildDir/reports/cpdReports")
	outDir.mkdirs()
	ant.taskdef(name: 'cpd', classname: 'net.sourceforge.pmd.cpd.CPDTask',
		classpath: configurations.pmd.asPath)
	ant.cpd(minimumTokenCount: '100', format: 'xml',
		outputFile: new File(outDir , 'cpd.xml')) {
			fileset(dir: "src/main/java") {
				include(name: '**/*.java')
			}
		}
	ant.xslt(in: new File(outDir, 'cpd.xml'),
             style: file('../configuration/code_quality/cpd/cpd-xslt-style.xsl'),
             out: new File(outDir, 'cpd.html'))
}

}

project(":project1_a_wholesale")
{
dependencies
{
compile project(":project1_shared")
}

}

project(":project1_shared")
{
dependencies
{
compile project(":project2_shared")
}
}