I want to export my code in a jar so I can reuse it in other projects. The question here is how to include the java-doc i wrote in the code in a way that it is displayed in the project where I use the jar file when displaying Quick documentation lookup (intellij ctrl+Q). How can I achieve that?
I commented the code where I need reference for usage like
/**
/* This is the method that is doing ....
/* @returns further info
public void bla() { ... }
I managed to export a separate jar file for java-doc and classes using maven. I want the docs to be displayed when I press ctrl+Q. I tried to import the docs manually - it works but this is really annoying. I want to tie them together in a jar containing both.
I've searched a lot of questions in here, the answer's are mostly like: "just don't do that because java is not meant to do so. ... " update: as I know now, that makes sense. I didn't knew how the repo-manegment of maven worked so I was confused on that. For others who are stuck here: the libs are stored in .m2/repository/com.example.lib/1.x/ (at least at my PC) where source.jar and java-doc.jar are stored sperate
But if I include the dependencies from maven remote repository, the docs will be available locally. I will have a quick reference by just pressing ctr+Q. I really want to have this with my own libs because I cant remember code I wrote years ago.
Can someone please help me with that? What should I type in pom.xml?
Quick answer
The quick answer is: you don't need to add other settings in
pom.xml(if you have no other requirements).generate 3 files
You only need to generate 3 files (xxx.jar, xxx-sources.jar, xxx-javadoc.jar).
In the state of using the default value, you don't need to add any other additional settings.
Run Command:
Install sources and javadoc jar
Run Command:
Example Project
pom.xml
Hello.java
## generate 3 files
You only need to generate 3 files (xxx.jar, xxx-sources.jar, xxx-javadoc.jar).
In the state of using the default value, you don't need to add any other additional settings.
Run Command:
Install sources and javadoc jar
Run Command: Copy
pom.xmltotargetdirtarget dir files
Run Command: install jar and source jar , javadoc jar to maven local repo (
~/.m2)(Ref: https://maven.apache.org/plugins/maven-install-plugin/usage.html )
Test Project - TestHello
pom.xml
ADD org.example Hello dependency
Open TestHello in IDEA
then you can use Ctl+Q , show javadoc, you can use Key F4
Jump to Source.