|
18 | 18 | import com.fasterxml.jackson.module.paranamer.ParanamerModule; |
19 | 19 | import com.g2forge.alexandria.adt.graph.v1.HGraph; |
20 | 20 | import com.g2forge.alexandria.java.core.enums.EnumException; |
21 | | -import com.g2forge.alexandria.java.core.error.UnreachableCodeError; |
22 | 21 | import com.g2forge.alexandria.java.core.helpers.HCollection; |
23 | 22 | import com.g2forge.alexandria.java.function.IFunction1; |
24 | 23 | import com.g2forge.alexandria.java.function.ISupplier; |
|
27 | 26 | import com.g2forge.alexandria.service.BasicServiceLoader; |
28 | 27 | import com.g2forge.alexandria.service.DefaultInstantiator; |
29 | 28 | import com.g2forge.gearbox.command.process.IProcess; |
| 29 | +import com.g2forge.gearbox.command.proxy.result.StreamResultSupplier; |
30 | 30 | import com.g2forge.gearbox.maven.HMaven; |
31 | 31 | import com.g2forge.gearbox.maven.IMaven; |
32 | 32 | import com.g2forge.gearbox.maven.MavenDownloadErrors; |
@@ -147,14 +147,16 @@ protected Path download(MavenCoordinates coordinates, Path path) { |
147 | 147 | Files.newOutputStream(path, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.WRITE).close(); |
148 | 148 | } else { |
149 | 149 | if (!process.isSuccess()) { |
150 | | - // Re-run the command so that we log the complete output |
151 | | - command.get().assertSuccess(); |
| 150 | + boolean rerunFailed; |
152 | 151 | try { |
153 | | - // Fail (again) just in case the re-run succeeded somehow, which would be REALLY weird |
154 | | - process.assertSuccess(); |
| 152 | + // Re-run the command so that we log the complete output |
| 153 | + log.error("Maven dependency copy failed, running again to log output:"); |
| 154 | + StreamResultSupplier.STANDARD.apply(command.get()).forEach(log::error); |
| 155 | + rerunFailed = false; |
155 | 156 | } catch (Throwable throwable) { |
156 | | - throw new UnreachableCodeError(throwable); |
| 157 | + rerunFailed = true; |
157 | 158 | } |
| 159 | + if (!rerunFailed) throw new Error("This error indicates that the maven dependency copy failed once, and succeeded on re-run. Perhaps a transient network failure? Try re-running this."); |
158 | 160 | } |
159 | 161 | Files.move(path.getParent().resolve(coordinates.getArtifactId() + "-" + coordinates.getVersion() + ".pom"), path); |
160 | 162 | } |
|
0 commit comments