mavenmaven-3maven-pluginmaven-site-plugin

Maven site "Maven Coordinates" page to indicate also the private repository to download from


In the maven-generated site page, in particular the "Maven Coordinates" page, I would like to add the information of the private repository to download the artifact.

Here is the snippet of my pom file:

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.21.0</version>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>taglist-maven-plugin</artifactId>
                <version>3.2.1</version>
                <configuration>
                    <tagListOptions>
                        <tagClasses>
                            <tagClass>
                                <tags>
                                    <tag>
                                        <matchString>todo</matchString>
                                        <matchType>ignoreCase</matchType>
                                    </tag>
                                </tags>
                            </tagClass>
                        </tagClasses>
                    </tagListOptions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>3.9.0</version>
            </plugin>
        </plugins>
    </reporting>

    <distributionManagement>
        <repository>
            <id>private-repository-release</id>
            <url>https://private.repository.com/artifactory/private-repository-release</url>
        </repository>
    </distributionManagement>

As you can see, this jar will be deployed to a private repository (here in my example https://private.repository.com/artifactory/private-repository-release)

For the sake of the question, let us assume this private repository does not need authentication.

When running mvn site on the above, I do get the generated maven website (working) but it looks like this (see image)

enter image description here

This page lacks information regarding the private repository to download. I would like to be able to indicate on the website the repository needed in the pom.

I would like to get this sort of result:

enter image description here

To tell the user of this jar the repository code block needs to be added to the site page.

  <repositories>
        <repository>
            <id>private-repository-release</id>
            <url>https://private.repository.com/artifactory/private-repository-release</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.example</groupId>
            <artifactId>deleteme-kafka</artifactId>
            <version>2.2</version>
        </dependency>

I tried adding the blocks in the pom, but no luck, the website does not indicate in the "Maven Coordinates" the private repository needed.

While the "Distribution management" page does indicate some information regarding the private repository, it does not tell the user of this jar how to configure the pom to download this "private jar".

How to add the repository section in the "Maven Coordinates" page?


Solution

  • You can not add the information in the Maven coordinates area, but what you can do is to use the maven-project-info-reports-plugin to accomplish that..

    via the following configuration: The important part is the entry: distributionManagemnet which will create a separate entry with those informations:

      <reporting>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <reportSets>
              <reportSet>
                <reports>
                  <report>dependencies</report>
                  <report>team</report>
                  <report>mailing-lists</report>
                  <report>issue-management</report>
                  <report>licenses</report>
                  <report>scm</report>
                  <report>index</report>
                  <report>summary</report>
                  <report>dependency-convergence</report>
                  <report>dependency-management</report>
                  <report>plugin-management</report>
                  <report>plugins</report>
                  <report>distribution-management</report>
                </reports>
              </reportSet>
            </reportSets>
          </plugin>
        </plugins>
      </reporting>
    

    In your particular case you have to enhance the reporting part with the configuration for the maven-project-info-reports-plugin as shown before.

    The results look like the following: https://maven.apache.org/plugins/maven-project-info-reports-plugin/project-info.html