Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE_REQ] Use Spring Apps plugin to configure a more accurate app name #2295

Open
moarychan opened this issue May 18, 2023 · 0 comments
Open

Comments

@moarychan
Copy link
Member

moarychan commented May 18, 2023

Plugin name and version

azure-spring-apps-maven-plugin, 1.17.0

Plugin configuration in your pom.xml

<plugin>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-spring-apps-maven-plugin</artifactId>
    <version>1.17.0</version>
    <configuration>
        <subscriptionId>xx</subscriptionId>
        <resourceGroup>rg-xxx</resourceGroup>
        <clusterName>moary15-xxx</clusterName>
        <appName>spring-petclinic-customers-service</appName>
        <isPublic>false</isPublic>
        <deployment>
            <cpu>1</cpu>
            <memoryInGB>1</memoryInGB>
            <instanceCount>1</instanceCount>
            <runtimeVersion>Java 17</runtimeVersion>
            <resources>
                <resource>
                    <filtering/>
                    <mergeId/>
                    <targetPath/>
                    <directory>${project.basedir}/target</directory>
                    <includes>
                        <include>*.jar</include>
                    </includes>
                </resource>
            </resources>
        </deployment>
    </configuration>
</plugin>

the application yml file of the module spring-petclinic-customers-service:

spring:
  application:
    name: customers-service

Expected behavior

The node appName under maven plugin azure-spring-apps-maven-plugin is <appName>customers-service</appName>.

Since Azure Spring Apps uses the name of the app as the service name of the built-in eureka service, the Maven plugin for Azure Spring Apps extracts the artifact ID in the POM file as the app name by default, so it needs to be consistent with the spring.application.name of each module. So the plugin should take the name from spring.application.name first, then take the name from the artifact ID if not the definition application name property. If the final app name exceeds the max length, it should require the user to rename it, and also providing a normal name by default will be better.

Actual behavior

It's <appName>spring-petclinic-customers-service</appName>, and will encounter an exception when executing xx:deploy, this is because the app name exceeds the max length.

Steps to reproduce the problem

  • Create ASA instance.
  • Clone code https://github.com/Azure-Samples/spring-petclinic-microservices
  • Navigate to the sample project directory, and execute mvnw com.microsoft.azure:azure-spring-apps-maven-plugin:1.17.0:config to configure all the sub-modules to ASA
  • Execute mvnw com.microsoft.azure:azure-spring-apps-maven-plugin:1.17.0:deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant