@@ -56,8 +56,7 @@ public static String getGradleCommand() {
56
56
}
57
57
}
58
58
59
- private static final String GRADLE_DEPENDENCIES_TASK = "allprojects { afterEvaluate { project -> task downloadDependencies(type: Copy) {\n " + " def configs = project.configurations.findAll { it.canBeResolved }\n \n " + " dependsOn configs\n " + " from configs\n " + " into project.hasProperty('outputDir') ? project.property('outputDir') : \" ${project.buildDir}/libs\" \n \n " + " doFirst {\n " + " println \" Downloading dependencies for project ${project.name} to: ${destinationDir}\" \n " + " configs.each { config ->\n " + " println \" Configuration: ${config.name}\" \n " + " config.resolvedConfiguration.resolvedArtifacts.each { artifact ->\n " + " println \" \t ${artifact.moduleVersion.id}:${artifact.extension}\" \n " + " }\n " + " }\n " + " }\n " + " }\n " + " }\n " + "}" ;
60
-
59
+ private static final String GRADLE_DEPENDENCIES_TASK = "allprojects { afterEvaluate { project -> task downloadDependencies(type: Copy) { def configs = project.configurations.findAll { it.canBeResolved }; dependsOn configs; from configs; into project.hasProperty('outputDir') ? project.property('outputDir') : \" ${project.buildDir}/libs\" ; eachFile { fileCopyDetails -> fileCopyDetails.file.setWritable(true) }; doFirst { println \" Downloading dependencies for project ${project.name} to: ${destinationDir}\" ; configs.each { config -> println \" Configuration: ${config.name}\" ; config.resolvedConfiguration.resolvedArtifacts.each { artifact -> println \" \\ t${artifact.moduleVersion.id}:${artifact.extension}\" } } } } } }" ;
61
60
private static AbstractMap .SimpleEntry <Boolean , String > commandExists (File command ) {
62
61
StringBuilder output = new StringBuilder ();
63
62
if (!command .exists ()) {
@@ -143,10 +142,10 @@ private static boolean mavenBuild(String projectPath) {
143
142
String [] mavenCommand ;
144
143
if (includeTestClasses ) {
145
144
Log .warn ("Hidden flag `--include-test-classes` is turned on. We'll including test classes in WALA analysis" );
146
- mavenCommand = new String []{MAVEN_CMD , "clean" , " test-compile" , "-f" , projectPath + "/pom.xml" , "-B" , "-V" , "-e" , "-Drat.skip" , "-Dfindbugs.skip" , "-Dcheckstyle.skip" , "-Dpmd.skip=true" , "-Dspotbugs.skip" , "-Denforcer.skip" , "-Dmaven.javadoc.skip" , "-DskipTests" , "-Dmaven.test.skip.exec" , "-Dlicense.skip=true" , "-Drat.skip=true" , "-Dspotless.check.skip=true" };
145
+ mavenCommand = new String []{MAVEN_CMD , "test-compile" , "-f" , projectPath + "/pom.xml" , "-B" , "-V" , "-e" , "-Drat.skip" , "-Dfindbugs.skip" , "-Dcheckstyle.skip" , "-Dpmd.skip=true" , "-Dspotbugs.skip" , "-Denforcer.skip" , "-Dmaven.javadoc.skip" , "-DskipTests" , "-Dmaven.test.skip.exec" , "-Dlicense.skip=true" , "-Drat.skip=true" , "-Dspotless.check.skip=true" };
147
146
}
148
147
else
149
- mavenCommand = new String []{MAVEN_CMD , "clean" , " compile" , "-f" , projectPath + "/pom.xml" , "-B" , "-V" , "-e" , "-Drat.skip" , "-Dfindbugs.skip" , "-Dcheckstyle.skip" , "-Dpmd.skip=true" , "-Dspotbugs.skip" , "-Denforcer.skip" , "-Dmaven.javadoc.skip" , "-DskipTests" , "-Dmaven.test.skip.exec" , "-Dlicense.skip=true" , "-Drat.skip=true" , "-Dspotless.check.skip=true" };
148
+ mavenCommand = new String []{MAVEN_CMD , "compile" , "-f" , projectPath + "/pom.xml" , "-B" , "-V" , "-e" , "-Drat.skip" , "-Dfindbugs.skip" , "-Dcheckstyle.skip" , "-Dpmd.skip=true" , "-Dspotbugs.skip" , "-Denforcer.skip" , "-Dmaven.javadoc.skip" , "-DskipTests" , "-Dmaven.test.skip.exec" , "-Dlicense.skip=true" , "-Drat.skip=true" , "-Dspotless.check.skip=true" };
150
149
151
150
return buildWithTool (mavenCommand );
152
151
}
@@ -155,14 +154,14 @@ public static boolean gradleBuild(String projectPath) {
155
154
// Adjust Gradle command as needed
156
155
String [] gradleCommand ;
157
156
if (GRADLE_CMD .equals ("gradlew" ) || GRADLE_CMD .equals ("gradlew.bat" )) {
158
- gradleCommand = new String []{projectPath + File .separator + GRADLE_CMD , "clean" , " compileJava" , "-p" , projectPath };
157
+ gradleCommand = new String []{projectPath + File .separator + GRADLE_CMD , "compileJava" , "-p" , projectPath };
159
158
} else {
160
159
if (includeTestClasses ) {
161
160
Log .warn ("Hidden flag `--include-test-classes` is turned on. We'll including test classes in WALA analysis" );
162
- gradleCommand = new String []{GRADLE_CMD , "clean" , " compileTestJava" , "-p" , projectPath };
161
+ gradleCommand = new String []{GRADLE_CMD , "compileTestJava" , "-p" , projectPath };
163
162
}
164
163
else
165
- gradleCommand = new String []{GRADLE_CMD , "clean" , " compileJava" , "-p" , projectPath };
164
+ gradleCommand = new String []{GRADLE_CMD , "compileJava" , "-p" , projectPath };
166
165
}
167
166
return buildWithTool (gradleCommand );
168
167
}
@@ -240,7 +239,7 @@ public static boolean downloadLibraryDependencies(String projectPath, String pro
240
239
));
241
240
}
242
241
Log .info ("Found pom.xml in the project directory. Using Maven to download dependencies." );
243
- String [] mavenCommand = {MAVEN_CMD , "--no-transfer-progress" , "-f" , Paths .get (projectRoot , "pom.xml" ).toAbsolutePath ().toString (), "dependency:copy-dependencies" , "-DoutputDirectory=" + libDownloadPath .toString ()};
242
+ String [] mavenCommand = {MAVEN_CMD , "--no-transfer-progress" , "-f" , Paths .get (projectRoot , "pom.xml" ).toAbsolutePath ().toString (), "dependency:copy-dependencies" , "-DoutputDirectory=" + libDownloadPath .toString (), "-Doverwrite=true" };
244
243
return buildWithTool (mavenCommand );
245
244
} else if (new File (projectRoot , "build.gradle" ).exists () || new File (projectRoot , "build.gradle.kts" ).exists ()) {
246
245
libDownloadPath = Paths .get (projectPath , "build" , LIB_DEPS_DOWNLOAD_DIR ).toAbsolutePath ();
0 commit comments