Das Profil dient hauptsächlich dazu, die Probleme verschiedener Variablen und Konfigurationen zu lösen, die in verschiedenen Umgebungen erforderlich sind.
Das Profil erscheint im Allgemeinen an zwei Stellen: Settings.xml, Pom.xml
In Settings.xml wird es im Allgemeinen zum Auswählen von Lagern verwendet (nur Aliyun-Lager können Settings.xml auf diese Weise konfigurieren).
In pom.xml wird es im Allgemeinen zum Aktivieren der Umgebungskonfiguration verwendet
<profiles>
<profile>
<id>local</id>
<properties>
<profiles.active>local</profiles.active>
</properties>
</profile>
<profile>
<id>elk</id>
<properties>
<profiles.active>elk</profiles.active>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
Der in Verbindung mit der Profilverpackung verwendete Build-Code ist wie folgt konfiguriert (kombiniert mit der Datei „application-${env}.properties“)
Teil von application-${env}.properties
application-prepub.properties 中 spring.profiles.active=prepub-qa
application-daily.properties 中 spring.profiles.active=daily
application.properties 中 spring.profiles.active=@env@