cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AppDynamics Gradle Plugin (Android) does not support Maven repositories with non-password credentials

Nick.Silin
Builder

Hi 

Project/environment setup:
1. Android Gradle Plugin: 8.1.1
2. AppDynamics Android agent: 23.7.1
3. Gradle version: 8.3
3. Java 17

In our company we need to migrate to new Maven repository (GitLab) and need to use header credentials for this new maven repo. Exactly as described in GitLab docs here: 

https://docs.gitlab.com/ee/user/packages/maven_repository/?tab=gradle#edit-the-client-configuration

So, basically our Maven repository configuration looks approximately like this:

maven {
url = uri("https://repo.url")
name = "GitLab"
credentials(HttpHeaderCredentials::class) {
name = "TokenHeader"
value = "TokenValue"
}
authentication {
create("header", HttpHeaderAuthentication::class)
}
}

The problem that once we add this to project configuration, the project starts failing on Gradle configuration stage with below stacktrace:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Can not use getCredentials() method when not using PasswordCredentials; please use getCredentials(Class)

...

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
...
Caused by: java.lang.IllegalStateException: Can not use getCredentials() method when not using PasswordCredentials; please use getCredentials(Class)
at org.gradle.api.internal.artifacts.repositories.AuthenticationSupporter.getCredentials(AuthenticationSupporter.java:62)
...
at org.gradle.internal.metaobject.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:60)
at org.gradle.api.internal.artifacts.repositories.DefaultMavenArtifactRepository_Decorated.getProperty(Unknown Source)
at com.appdynamics.android.gradle.DependencyInjector$1$_afterEvaluate_closure2$_closure6.doCall(DependencyInjector.groovy:93)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.addRepository(DefaultArtifactRepositoryContainer.java:88)
at org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.maven(DefaultRepositoryHandler.java:161)
at org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.maven(DefaultRepositoryHandler.java:167)
at org.gradle.api.artifacts.dsl.RepositoryHandler$maven.call(Unknown Source)
at com.appdynamics.android.gradle.DependencyInjector$1$_afterEvaluate_closure2.doCall(DependencyInjector.groovy:89)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at com.appdynamics.android.gradle.DependencyInjector$1.afterEvaluate(DependencyInjector.groovy:79)
at jdk.internal.reflect.GeneratedMethodAccessor2628.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingInvocationHandler$1.lambda$run$0(DefaultListenerBuildOperationDecorator.java:255)
...

From what I understood AppDynamics plugin is trying to use somehow maven repositories mentioned in the project and trying to work with them via some reflection API. And only assume that Maven repositories can have authentication via username/password.

I also found that it is somehow related to `adeum.dependencyInjection.enabled` property, but it is poorly documented. Well, I have not found any documentation about what it is doing at all, only single sentence mentioning it here: 

https://docs.appdynamics.com/appd/22.x/22.3/en/end-user-monitoring/mobile-real-user-monitoring/instr...

Anyway, after trying disabling this option, the project compiles, but app crashes in runtime when built.

So, questions are:

1. Is there any way to use Maven repository with non username/password option and AppDynamics plugin?
    We are not allowed to use different authentication for it, so AppDynamics plugin becoming a blocker for us for building the project.

2. Is there any documentation or knowledge about `adeum.dependencyInjection.enabled`, because it seems it is directly related to the issue?

1 REPLY 1

Ryan.Paredez
Community Manager

Hi @Nick.Silin,

Since you created a Support ticket, can you share the learnings/outcome as a reply here please.


Thanks,

Ryan, Cisco AppDynamics Community Manager




Found something helpful? Click the Accept as Solution button to help others find answers faster.

Liked something? Click the Thumbs Up button.



Check out Observabiity in Action

new deep dive videos weekly in the Knowledge Base.

On-Demand Webinar
Discover new Splunk integrations and AI innovations for Cisco AppDynamics.


Register Now!

Observe and Explore
Dive into our Community Blog for the Latest Insights and Updates!


Read the blog here
Top Kudoed Authors