-1

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

Dr. Snoopy
  • 55,122
  • 7
  • 121
  • 140
  • Does this answer your question? [How to force IntelliJ to download javadocs with Maven?](https://stackoverflow.com/questions/31072667/how-to-force-intellij-to-download-javadocs-with-maven) – SiKing Nov 15 '22 at 22:15
  • 1
    Hm.. are you sure you have not missed a step... https://search.maven.org/search?q=io.github.preafixed because I can not see any artifact with this groupId? – khmarbaise Nov 15 '22 at 22:29
  • yeah maybe I have messed up yikes. But I can implement the dependency in a project so it should have worked right? But you are right, I also can not see it on maven central – Cem Pamir Bana Nov 15 '22 at 22:35
  • @SiKing no thats not what I meant, I think the JavaDocs didn't get uploaded. – Cem Pamir Bana Nov 15 '22 at 22:36
  • Your question is unclear. If you are having problems with the upload, then you need to tell us what steps you took for the **upload**. All the other information is just a distraction. Have a read through how to create [mcve]. – SiKing Nov 15 '22 at 22:57
  • I edited my question, sorry – Cem Pamir Bana Nov 15 '22 at 23:05
  • I cannot find your artifact on [Maven Central](https://search.maven.org/search?q=io.github.preafixed), and trying to add it as a dependency to a test project fails. I suppose it's possible that the repository has not been fully "refreshed" yet. Though are you sure you haven't simply installed your artifact to the local repository? That said, you need to also deploy the Javadoc and/or the sources of your project, not just the compiled classes. Is that happening? Some Q&As I've looked at make it seem like this does not happen by default, but I'm not terribly familiar with Maven. – Slaw Nov 16 '22 at 02:38
  • Hm weird, you can find it under [link](https://s01.oss.sonatype.org/#nexus-search;quick~io.github.preafixed) , but I'm not sure if it has anything to do with maven central – Cem Pamir Bana Nov 16 '22 at 08:09

1 Answers1

2

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 :)