Support commercial repositories in effective BOM and Ivy
Update `BomExtension` to resolve '{spring.mavenRepositories}' and add credentials to `ivysettings.xml` and `settings.xml`. Closes gh-44050
This commit is contained in:
parent
fd5180645e
commit
80e8ab8779
|
@ -59,6 +59,7 @@ import org.w3c.dom.Document;
|
|||
import org.w3c.dom.NodeList;
|
||||
|
||||
import org.springframework.boot.build.DeployedPlugin;
|
||||
import org.springframework.boot.build.RepositoryTransformersExtension;
|
||||
import org.springframework.boot.build.bom.Library.Exclusion;
|
||||
import org.springframework.boot.build.bom.Library.Group;
|
||||
import org.springframework.boot.build.bom.Library.LibraryVersion;
|
||||
|
@ -132,6 +133,8 @@ public class BomExtension {
|
|||
|
||||
public void effectiveBomArtifact() {
|
||||
Configuration effectiveBomConfiguration = this.project.getConfigurations().create("effectiveBom");
|
||||
RepositoryTransformersExtension repositoryTransformers = this.project.getExtensions()
|
||||
.getByType(RepositoryTransformersExtension.class);
|
||||
this.project.getTasks()
|
||||
.matching((task) -> task.getName().equals(DeployedPlugin.GENERATE_POM_TASK_NAME))
|
||||
.all((task) -> {
|
||||
|
@ -144,8 +147,10 @@ public class BomExtension {
|
|||
sync.dependsOn(task);
|
||||
sync.setDestinationDir(generatedBomDir);
|
||||
sync.from(((GenerateMavenPom) task).getDestination(), (pom) -> pom.rename((name) -> "pom.xml"));
|
||||
sync.from(this.project.getResources().getText().fromString(loadSettingsXml()),
|
||||
(settingsXml) -> settingsXml.rename((name) -> "settings.xml"));
|
||||
sync.from(this.project.getResources().getText().fromString(loadSettingsXml()), (settingsXml) -> {
|
||||
settingsXml.rename((name) -> "settings.xml");
|
||||
settingsXml.filter(repositoryTransformers.mavenSettings());
|
||||
});
|
||||
});
|
||||
File effectiveBom = this.project.getLayout()
|
||||
.getBuildDirectory()
|
||||
|
|
|
@ -7,17 +7,7 @@
|
|||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-snapshot</id>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-milestone</id>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
</repository>
|
||||
<!-- {spring.mavenRepositories} -->
|
||||
</repositories>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
|
|
@ -11,5 +11,6 @@
|
|||
<!-- {spring.mavenRepositories} -->
|
||||
</chain>
|
||||
</resolvers>
|
||||
<credentials host="${env.COMMERCIAL_RELEASE_REPO_URL}" username="${env.COMMERCIAL_REPO_USERNAME}" passwd="${env.COMMERCIAL_REPO_PASSWORD}"/>
|
||||
<credentials host="${env.COMMERCIAL_SNAPSHOT_REPO_URL}" username="${env.COMMERCIAL_REPO_USERNAME}" passwd="${env.COMMERCIAL_REPO_PASSWORD}"/>
|
||||
</ivysettings>
|
||||
|
|
@ -1,6 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<settings>
|
||||
<localRepository>@localRepositoryPath@</localRepository>
|
||||
<servers>
|
||||
<server>
|
||||
<id>spring-commercial-release</id>
|
||||
<username>${env.COMMERCIAL_REPO_USERNAME}</username>
|
||||
<password>${env.COMMERCIAL_REPO_PASSWORD}</password>
|
||||
</server>
|
||||
<server>
|
||||
<id>spring-commercial-snapshot</id>
|
||||
<username>${env.COMMERCIAL_REPO_USERNAME}</username>
|
||||
<password>${env.COMMERCIAL_REPO_PASSWORD}</password>
|
||||
</server>
|
||||
</servers>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>it-repo</id>
|
||||
|
|
Loading…
Reference in New Issue