Should I link source and class files in one JAR?

Individual banks

When creating JAR files, I always saved the source code separately and offered it as an additional option.

eg:

  • Foo.jar
  • Foo-source.jar

This seems to be the obvious way to do things and is very common. Benefits:

  • Keeps a small binary jar
  • Source cannot be open / public
  • Faster for a class loader? (I have no idea, just guessing)

Single jar

I began to doubt whether it was always worth it. I am working on a tiny open source component. None of the above benefits were a problem in this project:

  • Classes + source is still trivially small (and will remain that way)
  • The source is open.
  • The download speed class of this jar does not matter.

, , :

  • , , ( )

. , , javadoc zip , (, Google guava), ?

, , , jar .

? ?

+3
5

, , javadoc zip , (, Google, guava), ?

, ! 2 , , .

, , , .

, . , / .

  • .
  • JAR , .
  • - , . JAR , ? , ?

/ , .

, , , . , , . , , , , , JAR, , .

+2

, / , . , .

0

java + .

java , jar javac, , java , .

, / java class ​​ .

java , , Java ( javac), javac Java , .

.

, javac : http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html#searching

0

, ?

, , , - , , , .

, , , , . , , "" . WAR , , , , , , , DEV.

0

" ".

Since the jar binary class is designed to run on the JVM, but the source is missing. The source must be carefully maintained by your version control system (SVN). If the source needs to be released, fasten it in a separate can. Many open source separate the class cluster and source code.

-1
source

Source: https://habr.com/ru/post/1761334/


All Articles