Always the same problems with dependency resolution & authentication with artifactory

134 views
Skip to first unread message

Patrick Hütter

unread,
Jun 2, 2014, 1:48:53 PM6/2/14
to grails-de...@googlegroups.com
Hi together!
It's a problem wich every few months occurs.
I do some grails upgrades and the app can't resolve my artifacts from my secured artifactory repository. This time i did an upgrade to grails 2.4.0 and yet again the problem exists.
I configured my repository as described in the grails documentation (wich seems very outdated) but grails can't resolve my dependencies from our repo. It doesn't authenticate correctly.

So my final questions wich many people already have asked:

How to configure grails (current 2.4.0) with maven as dependency-resolver to work with a private maven respository (artifactory) _with_ authentication correctly? What do i have to write to my BuildConfig to get it working?



This doesn't work:

if (Environment.current == Environment.PRODUCTION) {

            if (grails.project.dependency.resolver == "maven") {
                mavenRepo "http://repo.myRepoHost.com/plugins-release-local/", {
                    auth([
                            username: "reader",
                            password: "readerPw"
                    ])
                }
}

Graeme Rocher

unread,
Jun 6, 2014, 4:32:16 AM6/6/14
to grails-de...@googlegroups.com
Surely configuring only for production is causing the issue?

Cheers

Patrick Hütter

unread,
Jun 6, 2014, 5:26:43 AM6/6/14
to grails-de...@googlegroups.com
No i think development is also affected but i don't run into problems in development environment because i use inplace plugins. As you can see in the code snippet above i use some if clauses to check wether the app starts in production environment and if yes, use the repo and dependencies from there (instead inplace plugins). This worked fine a year and doesn't work anymore yet. I really tested everything what was in my mind but i can't solve this problem. I already checked the artifactory logs and credentials. Credentials are correct but the logs show that artifactory doesn't allow access to the repo for user "anonymous", so grails doesn't authenticate against the repo.

Patrick Hütter

unread,
Jun 17, 2014, 11:23:25 AM6/17/14
to grails-de...@googlegroups.com

Artifactory log always says that it's denying access to user anonymous. So grails (aether) isn't authenticating with the correct usernameAfter spending many hours i couldn't get it working with the new aether implementation.

Does somebody have a grails application with working artifactory/maven repo authentication or an example BuildConfig.groovy for that?

Graeme Rocher

unread,
Jun 17, 2014, 11:39:25 AM6/17/14
to grails-de...@googlegroups.com
I recommend running

grails -debug compile

And adding a break point on the line
https://github.com/grails/grails-core/blob/2.4.x/grails-aether/src/main/groovy/org/codehaus/groovy/grails/resolve/maven/aether/config/RepositoryConfiguration.groovy#L68

To check whether the Authentication selector is being configured
correctly for your repository.

Also raising a JIRA and attaching an example would help

Thanks
> --
> You received this message because you are subscribed to the Google Groups
> "Grails Dev Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to grails-dev-disc...@googlegroups.com.
> To post to this group, send email to grails-de...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/grails-dev-discuss/d21585a6-6630-4748-a753-f3510f43788e%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Graeme Rocher
Grails Project Lead
Pivotal

George Smith

unread,
Jun 17, 2014, 6:14:58 PM6/17/14
to grails-de...@googlegroups.com
Is there a reason that you don't want to give anonymous read-only access to your instance? We run a private instance behind a firewall as well, but allow read for everyone.

Patrick Hütter

unread,
Jun 18, 2014, 4:16:09 AM6/18/14
to grails-de...@googlegroups.com
Hi George,

no, anonymous doesn't have access to my repository. Only the "reader" account. My problem is that my grails app doesn't authenticate as "reader". Instead it authenticates as "anonymous".

Patrick Hütter

unread,
Jul 24, 2014, 3:02:56 PM7/24/14
to grails-de...@googlegroups.com
Hi together! I found a solution for my problem! I posted it on stackoverflow, you can find it here: http://stackoverflow.com/questions/24000409/how-to-configure-grails-2-4-0-to-resolve-artifacts-from-artifactory-with-authent/24941868#24941868


Am Montag, 2. Juni 2014 19:48:53 UTC+2 schrieb Patrick Hütter:

Graeme Rocher

unread,
Jul 25, 2014, 7:48:02 AM7/25/14
to grails-de...@googlegroups.com
I don't see how that is a solution, you're allowing anonymous access
to artifactory, essentially disabling security
> --
> You received this message because you are subscribed to the Google Groups
> "Grails Dev Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to grails-dev-disc...@googlegroups.com.
> To post to this group, send email to grails-de...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/grails-dev-discuss/a23ce46e-6f9f-4877-8013-a3bf5658e1e2%40googlegroups.com.

Patrick Hütter

unread,
Jul 25, 2014, 7:54:41 AM7/25/14
to grails-de...@googlegroups.com
At first it may look like i'm allowing anonymous access, that's true but in detail i don't. This flag is a general "parent" flag for security wich gets specified by the permissions part in the configuration. Repositories without permissions are public by default and repositories with created permissions can be private (for example if you grant only access from one account or group in the permissions dialog in the repository settings).

Patrick Hütter

unread,
Jul 25, 2014, 7:56:18 AM7/25/14
to grails-de...@googlegroups.com
Just for the correct understanding: I have public AND private repositories in my artifactory at the same time.

Graeme Rocher

unread,
Jul 25, 2014, 7:57:23 AM7/25/14
to grails-de...@googlegroups.com
Regardless this is nothing we can implement ourselves in Grails, will
need to be implemented by the underlying Eclipse Aether library, so no
point in reopening the issue

On Fri, Jul 25, 2014 at 1:54 PM, Patrick Hütter
>> > email to grails-dev-disc...@googlegroups.com.
>> > To post to this group, send email to grails-de...@googlegroups.com.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/grails-dev-discuss/a23ce46e-6f9f-4877-8013-a3bf5658e1e2%40googlegroups.com.
>> >
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> Graeme Rocher
>> Grails Project Lead
>> Pivotal
>
> --
> You received this message because you are subscribed to the Google Groups
> "Grails Dev Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to grails-dev-disc...@googlegroups.com.
> To post to this group, send email to grails-de...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/grails-dev-discuss/24dc1ed4-a88c-4f14-ab94-02d6da6763e1%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages