File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/skaffold Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -142,8 +142,24 @@ private void addGradleFiles(Project project) {
142142 skaffoldFilesOutput .addBuild (project .getBuildFile ().toPath ());
143143
144144 // Add settings.gradle
145- // Use reflection to call getSettingsFile() for compatibility with both Gradle 6 and 9
146- // (getSettingsFile() was removed in Gradle 9)
145+ addSettingsFile (project , projectPath );
146+
147+ // Add gradle.properties
148+ if (Files .exists (projectPath .resolve ("gradle.properties" ))) {
149+ skaffoldFilesOutput .addBuild (projectPath .resolve ("gradle.properties" ));
150+ }
151+ }
152+
153+ /**
154+ * Adds the settings.gradle file for a project.
155+ *
156+ * <p>Uses reflection to call getSettingsFile() for compatibility with both Gradle 6 and 9
157+ * (getSettingsFile() was removed in Gradle 9).
158+ *
159+ * @param project the project
160+ * @param projectPath the project directory path
161+ */
162+ private void addSettingsFile (Project project , Path projectPath ) {
147163 try {
148164 Object startParameter = project .getGradle ().getStartParameter ();
149165 java .lang .reflect .Method getSettingsFileMethod =
@@ -160,11 +176,6 @@ private void addGradleFiles(Project project) {
160176 skaffoldFilesOutput .addBuild (projectPath .resolve (Settings .DEFAULT_SETTINGS_FILE ));
161177 }
162178 }
163-
164- // Add gradle.properties
165- if (Files .exists (projectPath .resolve ("gradle.properties" ))) {
166- skaffoldFilesOutput .addBuild (projectPath .resolve ("gradle.properties" ));
167- }
168179 }
169180
170181 /**
You can’t perform that action at this time.
0 commit comments