Hyphen
Hyphen

Reputation: 1

maven use different repositoryId in 3.5.4 and 3.9.5

Here is part of my pom.xml:

<project>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>3.1.1</version>
                <executions>
                    <execution>
                        <id>repo-id-in-config</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy-file</goal>
                        </goals>
                        <configuration>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>${project.artifactId}</artifactId>
                            <version>${project.version}</version>
                            <file>target/${project.artifactId}-${project.version}.jar</file>
                            <url>${project.distributionManagement.snapshotRepository.url}</url>
                            <repositoryId>repo-id-in-config</repositoryId>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <distributionManagement>
        <snapshotRepository>
            <id>repo-id-in-distrib</id>
            <name>xxx</name>
            <url>xxx</url>
        </snapshotRepository>
    </distributionManagement>
</project>

And here is part of my settings.xml:

    <servers>
        <server>
            <id>repo-id-in-distrib</id>
            <username>userrname</username>
            <password>xxx</password>
        </server>
    </servers>

Firstly, I use maven 3.5.4 to build my repo. It works well with 3.5.4, when I run mvn deploy, maven use 'repo-id-in-distrib' as the server.id in settings.xml to do auth.

Then, I update my maven to 3.9.5, run mvn deploy, and get a 401-unauthorized error. In debug log, I found maven changed to use 'repo-id-in-config' as repository id to do auth.

Then, I changed my settings.xml as below:

    <servers>
        <server>
            <id>repo-id-in-config</id>
            <username>userrname</username>
            <password>xxx</password>
        </server>
    </servers>

It works! The mvn deploy success.

This is really confusing. I do not find any doc of maven about this. So, I wonder is any feature about this changed? Or what principle of this?

Upvotes: 0

Views: 25

Answers (0)

Related Questions