Построить и развернуть проект Maven для Nexus через Jenkins - PullRequest
0 голосов
/ 29 мая 2019

Я настроил простой проект Maven Freestyle.Мне удалось успешно построить проект, но не развернуть на Nexus.Я получаю эту ошибку:

[ОШИБКА] Не удалось выполнить цель org.apache.maven.plugins: maven-deploy-plugin: 2.8.1: deploy (default-deploy) в проекте eqs_utility: Не удалось развернуть артефакты: Не удалось найти артефактупростить проект, но все равно ничего. Setting.xml изменяется.

EDITED Я добавил следующее к своему POM.xml

    <distributionManagement>
        <repository>
            <uniqueVersion>false</uniqueVersion>
            <id>nexus</id>
            <name>Company Nexus Repository</name>
            <url>https://nexus.mycompany.com/repository/maven-release/</url>
            </repository>    
        <snapshotRepository>
            <uniqueVersion>true</uniqueVersion>
            <id>nexus</id>
            <name>Company Nexus Snapshots</name>
            <url>https://nexus.companyName.com/repository/maven-snapshot/</url>
        </snapshotRepository>
    </distributionManagement>

Затем обновил мойsettings.xml с этим

<server>
      <id>nexus</id>
      <filePermissions>664</filePermissions>
      <directoryPermissions>775</directoryPermissions>
    </server>


    <!-- Another sample, using keys to authenticate. -->
    <server>
      <id>nexus</id>
      <username>NexusUser</username>
      <password>MyLongTokenValueHere</password>
    </server>

1 Ответ

1 голос
/ 30 мая 2019

Согласно Настройка плагина Apache Maven Deploy

Вам нужен раздел:

  <distributionManagement>
    <repository>
      <id>internal.repo</id>
      <name>MyCo Internal Repository</name>
      <url>Host to Company Repository</url>
    </repository>
  </distributionManagement>

Поскольку вы используете Nexus, вам, вероятно, нужен раздел в pom, который выровнен с вашими репозиториями Nexus (один для моментальных снимков и один для артефактов выпуска, поскольку вы не можете объединить их в Nexus):

<distributionManagement>
   <repository>
      <id>mavenrepository</id>
      <url>http://mavenrepository.companyName.com/nexus/content/repositories/m3</url>
   </repository>
   <snapshotRepository>
      <id>tmavenrepository</id>
      <url>http://mavenrepository.companyName.com/nexus/content/repositories/m3-snapshots</url>
   </snapshotRepository>
</distributionManagement>

Плюс, конечно, в ваших локальных настройках или в другом частном месте

    <server>
      <id>mavenrepository</id>
      <username>maven</username>
      <password>foobar</password>
    </server>

Это описано Сонатип и чище другими .

...