Maven deployment error

I have a maven project with multiple modules. You need to deploy all modules (banks and one war) to a remote Artifactory server. So, a config is added to settings.xml:

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <servers>
    <server>
      <username>admin</username>
      <password>password</password>
      <id>central</id>
    </server>
    <server>
      <username>admin</username>
      <password>password</password>
      <id>snapshots</id>
    </server>
  </servers>
  <profiles>
    <profile>
      <repositories>
        <repository>
           <id>central</id>
          <name>libs-release</name>
          <url>http://192.168.1.120:8088/artifactory/libs-release</url>
        </repository>
        <repository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>http://192.168.1.120:8088/artifactory/libs-snapshot</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>plugins-release</name>
          <url>http://192.168.1.120:8088/artifactory/plugins-release</url>
        </pluginRepository>
        <pluginRepository>
          <snapshots />
          <id>snapshots</id>
          <name>plugins-snapshot</name>
          <url>http://192.168.1.120:8088/artifactory/plugins-snapshot</url>
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
</settings>

      

The main pom has a section:

<distributionManagement>
    <repository>
      <id>central</id>
      <url>http://192.168.1.120:8088/artifactory/libs-release-local</url>
    </repository>
    <snapshotRepository> 
        <id>snapshots</id>         
        <url>http://192.168.1.120:8088/artifactory/libs-snapshot-local</url> 
    </snapshotRepository>
  </distributionManagement>

      

And all modules are versioned 1.0-SNAPSHOT

. But when executing the command: >mvn deploy

the following error occurred:

[ERROR] Failed to execute target org.apache.maven.plugins: Maven-deployment-plugin: 2.5: deploy (default is deployment) by project assignment: failed to deploy artifacts: failed to not upload artifact * project-name: project -nam * e: pom: 0.0.1 from / to central (http://192.168.1.120:8088/artifactory/libs-release-local): transfer file failed: http://192.168.1.120:8088/artifactory /libs-release-local/project-name/project-name/0.0.1/project-name-0.0.1.pom . Return code: 401 → [Help 1]

How to deal with this?

UPDATE:

OK I understood. The 401 error says: 401 = "Unauthorized". So I added the correct username / password in settings.xml. Seems to work now.

You have one last question: is it correct that I am using the SNAPSHOT suffix in the version? Is this the correct behavior for a situation where I need to deploy all modules to a remote repo? How do I deal with a situation where one module has been broken and my colleagues need to use a previous version of that module?

+3


source to share


1 answer


Perhaps this is because it is written incorrectly. You can change it hhttp to http and try again.



+2


source







All Articles