将 setting.xml 中的 Maven 配置文件移动到 pom.xml
Moving maven profiles in setting.xml to pom.xml
我正在使用 maven3。我在 settings.xml 中定义了一些用户特定的配置文件和 activeProfiles 标签,我想将它们移动到项目的 pom.xml。
但是仅仅将配置文件和 activeProfiles 从 settings.xml 复制到 pom.xml 是行不通的并且会破坏构建,因为它试图在 maven central 而不是 artifactory 中找到项目的父 pom。这是我的 settings.xml 个人资料。
Maven 报告问题:
未能在 https://repo.maven.apache.org/maven2 中找到 xxx:xxx:pom:19.2 已缓存在本地存储库中,直到中央更新间隔已过或强制更新后才会重新尝试解析
有人可以帮忙吗?
{
<profiles>
<profile>
<id>group</id>
<repositories>
<repository>
<id>nb_releases</id>
<name>Releases</name>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://artifactory.xxxx.xxxx/nb-m2</url>
<layout>default</layout>
</repository>
</repositories>
</profile>
<profile>
<id>snapshots-group</id>
<repositories>
<repository>
<id>nb_snapshots</id>
<name>Snapshots</name>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<url>http://artifactory.xxxx.xxxx/nb-m2-snapshot</url>
<layout>default</layout>
</repository>
</repositories>
</profile>
<profile>
<id>plugins</id>
<pluginRepositories>
<pluginRepository>
<id>nb_plugins</id>
<name>Plugins</name>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://artifactory.xxx.xxx/nb-m2</url>
<layout>default</layout>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>group</activeProfile>
<activeProfile>snapshots-group</activeProfile>
<activeProfile>plugins</activeProfile>
</activeProfiles>
}
标签<activeProfiles>
只能在settings.xml
中使用,不能在POM中使用。
激活可在 POM 中使用的配置文件有不同的可能性:
https://maven.apache.org/guides/introduction/introduction-to-profiles.html
我正在使用 maven3。我在 settings.xml 中定义了一些用户特定的配置文件和 activeProfiles 标签,我想将它们移动到项目的 pom.xml。 但是仅仅将配置文件和 activeProfiles 从 settings.xml 复制到 pom.xml 是行不通的并且会破坏构建,因为它试图在 maven central 而不是 artifactory 中找到项目的父 pom。这是我的 settings.xml 个人资料。 Maven 报告问题: 未能在 https://repo.maven.apache.org/maven2 中找到 xxx:xxx:pom:19.2 已缓存在本地存储库中,直到中央更新间隔已过或强制更新后才会重新尝试解析
有人可以帮忙吗?
{
<profiles>
<profile>
<id>group</id>
<repositories>
<repository>
<id>nb_releases</id>
<name>Releases</name>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://artifactory.xxxx.xxxx/nb-m2</url>
<layout>default</layout>
</repository>
</repositories>
</profile>
<profile>
<id>snapshots-group</id>
<repositories>
<repository>
<id>nb_snapshots</id>
<name>Snapshots</name>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<url>http://artifactory.xxxx.xxxx/nb-m2-snapshot</url>
<layout>default</layout>
</repository>
</repositories>
</profile>
<profile>
<id>plugins</id>
<pluginRepositories>
<pluginRepository>
<id>nb_plugins</id>
<name>Plugins</name>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://artifactory.xxx.xxx/nb-m2</url>
<layout>default</layout>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>group</activeProfile>
<activeProfile>snapshots-group</activeProfile>
<activeProfile>plugins</activeProfile>
</activeProfiles>
}
标签<activeProfiles>
只能在settings.xml
中使用,不能在POM中使用。
激活可在 POM 中使用的配置文件有不同的可能性:
https://maven.apache.org/guides/introduction/introduction-to-profiles.html