Skip to content

Commit

Permalink
Add local repo to ExecutionContext hoping to fix non-resolvable local…
Browse files Browse the repository at this point in the history
… project issue
  • Loading branch information
fabapp2 committed Aug 2, 2023
1 parent c15b45e commit c33eeaa
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
import org.openrewrite.SourceFile;
import org.openrewrite.marker.Marker;
import org.openrewrite.maven.AbstractRewriteMojo;
import org.openrewrite.maven.MavenExecutionContextView;
import org.openrewrite.maven.MavenMojoProjectParser;
import org.openrewrite.maven.tree.MavenRepository;
import org.openrewrite.style.NamedStyles;
import org.openrewrite.tree.ParsingEventListener;
import org.openrewrite.tree.ParsingExecutionContextView;
Expand Down Expand Up @@ -84,7 +86,7 @@ public RewriteProjectParsingResult parse(Path baseDir, List<Resource> resources,
if(!baseDir.isAbsolute()) {
baseDir = baseDir.toAbsolutePath().normalize();
}

MavenExecutionContextView.view(executionContext).setLocalRepository(new MavenRepository("local", "file://" + Path.of(System.getProperty("user.home")).resolve(".m2/repository"), null, null, false, null, null, null));
eventPublisher.publishEvent(new StartedParsingProjectEvent(resources));

ParsingExecutionContextView.view(executionContext).setParsingListener(parsingEventListener);
Expand Down

0 comments on commit c33eeaa

Please sign in to comment.