Search code examples
javamavenjavadoc

I uploaded my project to Maven but the JavaDoc is gone


I recently decided to upload my library to Maven Central, but now that I have imported it, my Javadoc is gone.

I imported the project like this:

<dependency>
    <groupId>io.github.preafixed</groupId>
    <artifactId>java-tf</artifactId>
    <version>1.2-SNAPSHOT</version>
</dependency>

But if I inspect the code in IntelliJ, there is no JavaDoc.

Thank you for your help :)

I have generated the JavaDoc explicitly with Maven, but it seems like it has not uploaded it?

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>3.4.1</version>
    <configuration>
        <source>16</source>
    </configuration>
</plugin>

The Steps I took to upload:

Created a Sonartype account and issued a creation

Then I created the settings.xml file with my credentials

I inserted this lines in my pom.xml

<distributionManagement>
    <snapshotRepository>
        <id>ossrh</id>
        <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
        <id>ossrh</id>
        <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
</distributionManagement>

then I typed: maven deploy

I have no clue why my javadoc did not get uploaded


Solution

  • Hey I found the solution,

    I had not created a gpg key and therefor my staging failed, after adding these lines of code:

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    

    And generating my key with gpg4win, I ran maven clean deploy and it started uploading to sonartype. Then I looked at the staging repositories, and closed my staging. Only then I could release the repository.

    Hope it helps anyone :)