Skip to content

Conversation

octonato
Copy link
Contributor

@octonato octonato commented Jul 10, 2025

Draft: just exploring some ideas to easy the the token retrieval.

Some extra information that will help understand how this will work.

The precedence order to resolve properties is the following:

  • Command line properties (-Dproperty=value) (also anything in ~/.mvn/maven.config)
  • User settings.xml properties
  • Project POM properties
  • Parent POM properties (lowest priority)

This PR is changing the parent pom to have the following:

<properties>
  <akka-token>invalid-token</akka-token>
  <akka-secure-repo>https://repo.akka.io/${akka-token}/secure</akka-secure-repo>
</properties>

<repositories>
    <repository>
        <id>akka-secure</id>
        <name>Akka Secure</name>
        <url>${akka-secure-repo}</url>
    </repository>
</repositories>

If no changes are made, the resulting URL will be https://repo.akka.io/invalid-token/secure. The most effective solution is to detect this scenario and display a clear, informative message to the user.

When a user obtains a token via the CLI, it will be added to their ~/.mvn/maven.config as -Dakka-token=user-token. Alternatively, users can choose to add the token directly to their settings.xml if they prefer.

This approach works well for us because it centralizes the repository configuration in the parent POM, giving us greater control. For instance, if we need to migrate the repository URL, we can simply update the parent POM, rather than asking users to modify their settings.xml files individually.

@octonato octonato force-pushed the octonato/load-akka-token branch from 27ab2e0 to 021affa Compare July 10, 2025 17:05
Copy link
Contributor Author

@octonato octonato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea here is that the CLI could take care of the token and add it to ~/.mvn/maven.config.

This file will have the following content:

=❯ cat ~/.mvn/maven.config
-Dakka-token=user-token-goes-here

It's is automatically loaded by maven and the variables are passed to the build. Therefore, the ${akka-token} variable is resolved.

We should find a way to print a nice message in case it's missing, for example.

@@ -54,22 +54,23 @@
<maven-failsafe-plugin.version>3.1.2</maven-failsafe-plugin.version>
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>

<akka-token>invalid-token</akka-token>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebastian-alfers / @JustinPihony, would it be possible to fail the download with a clear message in case the passed token is invalid-token?

@octonato octonato force-pushed the octonato/load-akka-token branch from 021affa to 7a2fe4c Compare July 10, 2025 20:49
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<akka-secure-repo>https://repo.akka.io/maven/github_actions</akka-secure-repo>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most info is in the parent pom. Therefore the settings.xml that we use in the build can define only the repo url.

@octonato octonato changed the title feat: resolve reporitory with akka-token variable feat: resolve repository with akka-token variable Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant