You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "wujek.srujek" <wu...@gmail.com> on 2009/12/02 11:22:16 UTC

Security credentials to repository on the command line

Hi. Here is my situation: we have an internal repository that used HTTP basic
authentication. This repository is defined in the parent pom of the project
to create a portable build. However, when I check this project out along
with its submodules, mvn package doesn't download the dependencies, as maven
complains it doesn't have the security credentials and cannot authenticate.
The only way I could find is to put the credentials in the settings.xml
file. However, this will require the user to create this file somehow, so
the build will be environment-dependent. I can make this settings.xml file
available somewhere, but this will require more actions from the user and
also it will have to be remembered. The other option is to allow anonymous
read access to our repository, but this is outside my decision, and it will
not happen. Another option would be to be able to specify the security
credentials and repository id on the command line; I couldn't find anything
on the net, however.
Is specifying the credentials on the command line possible at all? I know
this can be messy, as there can be many repositories and I would have to
somehow bind the credentials to the correct repo. Something like this maybe:
mvn package -DrepositoryId.1=id1 -Did1.username=user1 -Did1.password=pass1
-DrepositoryId.2=id2 -Did2.username=user2 -Did2.password=pass2

or maybe there is any other way?

Regards.
-- 
View this message in context: http://old.nabble.com/Security-credentials-to-repository-on-the-command-line-tp26606415p26606415.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Security credentials to repository on the command line

Posted by Anders Hammar <an...@hammar.net>.
As you say you either grant anonymous access to the repo or you don't. If
you don't allow anonymous access, every user needs to provide his/her
credentials. This is what the user specific settings.xml file is for. Put it
there.

If you think that creating that file is difficult for a user, you need to
look into some tool aiding you with that. One way is through a Maven plugin
included in Nexus Pro (the licensed version of Nexus), but it shouldn't be
too hard creating some default template file somewhere and then provide a
script or the command to copy that file.

/Anders

On Wed, Dec 2, 2009 at 11:22, wujek.srujek <wu...@gmail.com> wrote:

>
> Hi. Here is my situation: we have an internal repository that used HTTP
> basic
> authentication. This repository is defined in the parent pom of the project
> to create a portable build. However, when I check this project out along
> with its submodules, mvn package doesn't download the dependencies, as
> maven
> complains it doesn't have the security credentials and cannot authenticate.
> The only way I could find is to put the credentials in the settings.xml
> file. However, this will require the user to create this file somehow, so
> the build will be environment-dependent. I can make this settings.xml file
> available somewhere, but this will require more actions from the user and
> also it will have to be remembered. The other option is to allow anonymous
> read access to our repository, but this is outside my decision, and it will
> not happen. Another option would be to be able to specify the security
> credentials and repository id on the command line; I couldn't find anything
> on the net, however.
> Is specifying the credentials on the command line possible at all? I know
> this can be messy, as there can be many repositories and I would have to
> somehow bind the credentials to the correct repo. Something like this
> maybe:
> mvn package -DrepositoryId.1=id1 -Did1.username=user1 -Did1.password=pass1
> -DrepositoryId.2=id2 -Did2.username=user2 -Did2.password=pass2
>
> or maybe there is any other way?
>
> Regards.
> --
> View this message in context:
> http://old.nabble.com/Security-credentials-to-repository-on-the-command-line-tp26606415p26606415.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>