Username/password not sent for altDeploymentRepository?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Username/password not sent for altDeploymentRepository?

Mark Raynsford-3
Hello!

As is probably obvious from my other questions, I'm currently setting up
a local repository manager (Apache Archiva in this instance) used to
deploy internal releases (things that won't make it to Central), and to
act as a proxy for Central for my local network.

Archiva appears to be set up correctly, I can log in to the admin
interface and upload artifacts via that without issue. However, I seem
to be unable to deploy via "mvn deploy". I'm using a profile to use the
repository manager conditionally, because *most* of the time I want to
deploy directly to Central. I don't want to add the address of the
repository manager to each project pom, because that information is
strictly internal. My ~/.m2/settings.xml file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<settings
  xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <profiles>
    <profile>
      <id>example</id>
      <repositories>
        <repository>
          <id>example-releases</id>
          <name>Example Releases</name>
          <url>https://packages.example.com/repository/example-releases/</url>
          <layout>default</layout>
        </repository>
      </repositories>
    </profile>
    <profile>
      <id>example-deploy</id>
      <properties>
        <altDeploymentRepository>example-releases::default::https://packages.example.com/repository/example-releases/</altDeploymentRepository>
      </properties>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>example</activeProfile>
  </activeProfiles>
  <mirrors>
    <mirror>
      <id>packages.example.com</id>
      <url>https://packages.example.com/repository/releases/</url>
      <mirrorOf>external:*</mirrorOf>
    </mirror>
  </mirrors>
  <servers>
    <server>
      <id>example-releases</id>
      <username>io7m</username>
      <password>XXXXXXXX</password>
    </server>
  </servers>
</settings>

When I call "mvn -P example-deploy", Maven correctly tries to deploy
via the https://packages.example.com/repository/example-releases/ repos
instead of Central, but it seems like it refuses to send a username and
password. I get a 401 error from Archiva. The Archiva logs mention:

2018-11-04 12:14:16,266 [qtp367589601-760] INFO  org.apache.archiva.security.ArchivaServletAuthenticator [] - Authorization Denied [ip=10.2.4.1,permission=archiva-upload-repository,repo=arc7-releases] : no matching permissions
2018-11-04 12:14:19,359 [qtp367589601-760] INFO  org.apache.archiva.security.ArchivaServletAuthenticator [] - Authorization Denied [ip=10.2.4.1,permission=archiva-upload-repository,repo=arc7-releases] : no matching permissions
2018-11-04 12:14:52,504 [qtp367589601-761] INFO  org.apache.archiva.security.ArchivaServletAuthenticator [] - Authorization Denied [ip=10.2.4.1,permission=archiva-upload-repository,repo=arc7-releases] : no matching permissions
2018-11-04 12:14:55,567 [qtp367589601-760] INFO  org.apache.archiva.security.ArchivaServletAuthenticator [] - Authorization Denied [ip=10.2.4.1,permission=archiva-upload-repository,repo=arc7-releases] : no matching permissions

Is there some way to verify that the username and password really is
(or isn't being sent)? Is there something I've set up incorrectly here?

I've had no problems to date deploying to Central, so I'm surprised
that I'm having problems here.

Just so we're clear: I'm deploying to /repository/example-releases, as
this is a repository that holds local releases, but I'm downloading
artifacts via /repository/releases as this is a repository group that
contains a proxy for Central.

--
Mark Raynsford | http://www.io7m.com


attachment0 (235 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Username/password not sent for altDeploymentRepository?

Mark Raynsford-3
On 2018-11-04T12:30:32 +0000
Mark Raynsford <[hidden email]> wrote:
>
> 2018-11-04 12:14:16,266 [qtp367589601-760] INFO  org.apache.archiva.security.ArchivaServletAuthenticator [] - Authorization Denied [ip=10.2.4.1,permission=archiva-upload-repository,repo=arc7-releases] : no matching permissions
> 2018-11-04 12:14:19,359 [qtp367589601-760] INFO  org.apache.archiva.security.ArchivaServletAuthenticator [] - Authorization Denied [ip=10.2.4.1,permission=archiva-upload-repository,repo=arc7-releases] : no matching permissions
> 2018-11-04 12:14:52,504 [qtp367589601-761] INFO  org.apache.archiva.security.ArchivaServletAuthenticator [] - Authorization Denied [ip=10.2.4.1,permission=archiva-upload-repository,repo=arc7-releases] : no matching permissions
> 2018-11-04 12:14:55,567 [qtp367589601-760] INFO  org.apache.archiva.security.ArchivaServletAuthenticator [] - Authorization Denied [ip=10.2.4.1,permission=archiva-upload-repository,repo=arc7-releases] : no matching permissions

That should have read "example-releases" - pasted the wrong set of
lines. The error is the same, however.

--
Mark Raynsford | http://www.io7m.com


attachment0 (235 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Username/password not sent for altDeploymentRepository?

Mark Raynsford-3
I've been completely unable to get this work. It seems like
altDeploymentRepository just doesn't pick up credentials for whatever
reason.

I've instead taken this approach: In my organization-wide POM, I've
added a profile:

    <!-- Allow deploying to an alternate repository -->
    <profile>
      <id>io7m-alternate-repository</id>
      <activation>
        <property>
          <name>io7m.useAlternateRepository</name>
        </property>
      </activation>
      <distributionManagement>
        <repository>
          <id>${io7m.repository.releases.id}</id>
          <url>${io7m.repository.releases.url}</url>
        </repository>
        <snapshotRepository>
          <id>${io7m.repository.snapshots.id}</id>
          <url>${io7m.repository.snapshots.url}</url>
        </snapshotRepository>
      </distributionManagement>
    </profile>

I then deploy with:

$ mvn \
  -Dio7m.useAlternateRepository=true                                                               \
  -Dio7m.repository.releases.id=example-releases                                                   \
  -Dio7m.repository.releases.url=https://packages.example.com:8443/repository/example-releases/    \
  -Dio7m.repository.snapshots.id=example-snapshots                                                 \
  -Dio7m.repository.snapshots.url=https://packages.example.com:8443/repository/example-snapshots/  \
  clean deploy

I have a <servers> element in settings.xml that supplies credentials for
repositories with ids "example-releases" and "example-snapshots" and
the credentials are picked up correctly by the deploy plugin.

--
Mark Raynsford | http://www.io7m.com


attachment0 (235 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Username/password not sent for altDeploymentRepository?

Mirko Friedenhagen-5
Maybe you run into https://issues.apache.org/jira/plugins/servlet/mobile#issue/MDEPLOY-244. maven-deploy-Plugin 3.0x has a slightly different syntax for specifying alt*Repositories.

Best Regards
Mirko Friedenhagen

Sent from my mobile

Am 04.11.18 um 22:47 schrieb Mark Raynsford

> I've been completely unable to get this work. It seems like
> altDeploymentRepository just doesn't pick up credentials for whatever
> reason.
>
> I've instead taken this approach: In my organization-wide POM, I've
> added a profile:
>
>     <!-- Allow deploying to an alternate repository -->
>     <profile>
>       <id>io7m-alternate-repository</id>
>       <activation>
>         <property>
>           <name>io7m.useAlternateRepository</name>
>         </property>
>       </activation>
>       <distributionManagement>
>         <repository>
>           <id>${io7m.repository.releases.id}</id>
>           <url>${io7m.repository.releases.url}</url>
>         </repository>
>         <snapshotRepository>
>           <id>${io7m.repository.snapshots.id}</id>
>           <url>${io7m.repository.snapshots.url}</url>
>         </snapshotRepository>
>       </distributionManagement>
>     </profile>
>
> I then deploy with:
>
> $ mvn \
>   -Dio7m.useAlternateRepository=true                                                               \
>   -Dio7m.repository.releases.id=example-releases                                                   \
>   -Dio7m.repository.releases.url=https://packages.example.com:8443/repository/example-releases/    \
>   -Dio7m.repository.snapshots.id=example-snapshots                                                 \
>   -Dio7m.repository.snapshots.url=https://packages.example.com:8443/repository/example-snapshots/  \
>   clean deploy
>
> I have a <servers> element in settings.xml that supplies credentials for
> repositories with ids "example-releases" and "example-snapshots" and
> the credentials are picked up correctly by the deploy plugin.
>
> --
> Mark Raynsford | http://www.io7m.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Username/password not sent for altDeploymentRepository?

Mark Raynsford-3
On 2018-11-04T23:16:31 +0100
"Mirko Friedenhagen" <[hidden email]> wrote:

> Maybe you run into https://issues.apache.org/jira/plugins/servlet/mobile#issue/MDEPLOY-244. maven-deploy-Plugin 3.0x has a slightly different syntax for specifying alt*Repositories.
>

Ouch! Yes, that would explain it. I did notice something odd in the
output of mvn -X:

[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://packages.example.com/repository/example-releases
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://packages.example.com/repository/example-releases
Uploading to example-releases::default: https://packages.example.com/repository/example-releases/com/io7m/testartifact/com.io7m.testartifact/0.0.1/com.io7m.testartifact-0.0.1.jar
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Notice that suspicious space after "default". Given MDEPLOY-244, it
looks as though "example-releases::default" is being treated as the
repository ID (and therefore isn't finding credentials in settings.xml).

--
Mark Raynsford | http://www.io7m.com


attachment0 (235 bytes) Download Attachment