Перемещение профилей maven в настройку. xml в pom. xml - PullRequest
0 голосов
/ 12 января 2020

Я использую Maven3. У меня есть некоторые пользовательские профили c и теги activeProfiles, определенные в настройках. xml, и я хочу переместить их в пометку проекта. xml. Но простое копирование профилей и активных профилей из настроек. xml в pom. xml не работает и прерывает сборку, потому что он пытается найти родительский pom проекта в maven central вместо artifactory. Вот мои настройки. xml анкеты. Проблема с отчетами Maven: Не удалось найти xxx: xxx: pom: 19.2 в https://repo.maven.apache.org/maven2, который был кэширован в локальном репозитории, разрешение не будет повторяться до тех пор, пока не истечет интервал обновления центрального сервера или принудительные обновления

Может кто-нибудь помочь, пожалуйста?

{

    <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>
} 

1 Ответ

0 голосов
/ 12 января 2020

Тег <activeProfiles> может использоваться только в settings.xml, но не в POM.

Существуют различные возможности активировать профиль, который можно использовать в POM:

https://maven.apache.org/guides/introduction/introduction-to-profiles.html

...