Skip to content

Commit

Permalink
Fix download error in build
Browse files Browse the repository at this point in the history
Dependencies were not downloaded by RewriteMavenProjectParser. Adding the repository definition solved the issue.
  • Loading branch information
fabapp2 committed Nov 1, 2023
1 parent 0abcb08 commit 0d27f1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import org.springframework.sbm.boot.autoconfigure.SbmSupportRewriteConfiguration;
import org.springframework.sbm.parsers.maven.RewriteMavenProjectParser;
import org.springframework.sbm.parsers.maven.SbmTestConfiguration;
import org.springframework.sbm.test.util.ParallelParsingResult;
import org.springframework.sbm.test.util.ParserExecutionHelper;
import org.springframework.sbm.test.util.TestProjectHelper;

import java.nio.file.Path;
Expand Down Expand Up @@ -60,8 +62,9 @@ public class CompareParserRecipeRunTest {
@DisplayName("Running a recipe with RewriteMavenParser should yield the same result as with RewriteProjectParser")
void runningARecipeWithRewriteMavenParserYieldsTheSameResultAsWithRewriteProjectParser() {
Path baseDir = TestProjectHelper.getMavenProject("parser-recipe-run");
RewriteProjectParsingResult sutParsingResult = sut.parse(baseDir);
RewriteProjectParsingResult compParsingResult = comparingParser.parse(baseDir);
ParallelParsingResult parallelParsingResult = new ParserExecutionHelper().parseParallel(baseDir);
RewriteProjectParsingResult sutParsingResult = parallelParsingResult.testedParsingResult();
RewriteProjectParsingResult compParsingResult = parallelParsingResult.comparingParsingResult();

AtomicInteger counter = new AtomicInteger(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.MavenArtifactRepository;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest;
Expand Down Expand Up @@ -75,6 +76,8 @@ public MavenExecutionRequest createMavenExecutionRequest(PlexusContainer plexusC
userProperties.put("skipTests", "true");
request.setUserProperties(userProperties);

request.setRemoteRepositories(List.of(new MavenArtifactRepository("central", "https://repo.maven.apache.org/maven2", new DefaultRepositoryLayout(), new ArtifactRepositoryPolicy(true, "never", "warn"), new ArtifactRepositoryPolicy(true, "never", "warn"))));

// TODO: make profile configurable
// fixes the maven run when plugins depending on Java version are encountered.
// This is the case for some transitive dependencies when running against the SBM code base itself.
Expand Down

0 comments on commit 0d27f1b

Please sign in to comment.