@@ -56,8 +56,7 @@ public static String getGradleCommand() {
5656 }
5757 }
5858
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}\" } } } } } }" ;
6160 private static AbstractMap .SimpleEntry <Boolean , String > commandExists (File command ) {
6261 StringBuilder output = new StringBuilder ();
6362 if (!command .exists ()) {
@@ -143,10 +142,10 @@ private static boolean mavenBuild(String projectPath) {
143142 String [] mavenCommand ;
144143 if (includeTestClasses ) {
145144 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" };
147146 }
148147 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" };
150149
151150 return buildWithTool (mavenCommand );
152151 }
@@ -155,14 +154,14 @@ public static boolean gradleBuild(String projectPath) {
155154 // Adjust Gradle command as needed
156155 String [] gradleCommand ;
157156 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 };
159158 } else {
160159 if (includeTestClasses ) {
161160 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 };
163162 }
164163 else
165- gradleCommand = new String []{GRADLE_CMD , "clean" , " compileJava" , "-p" , projectPath };
164+ gradleCommand = new String []{GRADLE_CMD , "compileJava" , "-p" , projectPath };
166165 }
167166 return buildWithTool (gradleCommand );
168167 }
@@ -240,7 +239,7 @@ public static boolean downloadLibraryDependencies(String projectPath, String pro
240239 ));
241240 }
242241 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" };
244243 return buildWithTool (mavenCommand );
245244 } else if (new File (projectRoot , "build.gradle" ).exists () || new File (projectRoot , "build.gradle.kts" ).exists ()) {
246245 libDownloadPath = Paths .get (projectPath , "build" , LIB_DEPS_DOWNLOAD_DIR ).toAbsolutePath ();
0 commit comments