Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

315 refresh pom model after add repository #344

Merged
merged 4 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@
<enabled>false</enabled>
</snapshots>
</repository>
<!-- <repository>-->
<!-- <id>spring-milestone</id>-->
<!-- <url>https://repo.spring.io/milestone</url>-->
<!-- <snapshots>-->
<!-- <enabled>false</enabled>-->
<!-- </snapshots>-->
<!-- </repository>-->
<repository>
<id>spring-release</id>
<url>https://repo.spring.io/release</url>
Expand All @@ -81,12 +74,7 @@
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestone</id>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>

<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -713,8 +713,10 @@ public void excludeDependencies(List<Dependency> excludedDependencies) {

@Override
public void addRepository(RepositoryDefinition repository) {
AddMavenRepository addMavenRepository = new AddMavenRepository(repository);
apply(addMavenRepository);
Recipe recipe = new AddMavenRepository(repository)
.doNext(new RefreshPomModel());

apply(recipe);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,16 @@ void shouldIgnoreRepositotyIfSameIdExists() {
" </repositories>\n" +
"</project>");
}
}

@Test
public void shouldRefreshPomModel() {
ProjectContext context = TestProjectContext.buildProjectContext().build();
AddRepositoryAction sut = new AddRepositoryAction();
sut.setUrl("my url");
sut.setId("my id");
sut.apply(context);

assertThat(context.getBuildFile().getRepositories()).hasSize(1);
}
}