Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to skip javadoc dependency download with sbt

Tags:

javadoc

scala

sbt

1) Javadoc artifacts tend to take too much space and time to download. For example, scala-library-2.10.2-sources.jar is 1 Mb, but scala-library-2.10.2-javadoc.jar is 34 Mb.

2) Javadoc is mostly not needed at all. As modern IDEs can fetch all info from sources.

So I wanted to find a way to alter sbt settings to completely disable javadoc download among third-party library dependencies.

like image 418
Vadzim Avatar asked Dec 01 '13 14:12

Vadzim


People also ask

How does sbt resolve dependencies?

Background. update resolves dependencies according to the settings in a build file, such as libraryDependencies and resolvers . Other tasks use the output of update (an UpdateReport ) to form various classpaths. Tasks that in turn use these classpaths, such as compile or run , thus indirectly depend on update .

Where are dependencies downloaded in SBT?

unmanaged dependencies are jars dropped into the lib directory. managed dependencies are configured in the build definition and downloaded automatically from repositories.

What is SBT dependency?

SBT Dependencies SBT is the most usual build tool for Scala projects. As a project gets more complex, it will increase the number of dependencies. And each dependency brings other dependencies, called transitive dependencies. Eventually, a project can suffer from the JAR dependency hell.

What is Ivy sbt?

sbt provides an interface to the repository types available in Ivy: file, URL, SSH, and SFTP. A key feature of repositories in Ivy is using patterns to configure repositories.


1 Answers

https://github.com/mpeltonen/sbt-idea/issues/225#issuecomment-19150022 kindly gives the answer:

The javadoc is typically much more bulky and less useful than the sources. I have at least turned off downloading javadocs by putting this setting in ~/.sbt/build.sbt:

transitiveClassifiers in Global := Seq(Artifact.SourceClassifier)

See also What is a classifier in SBT.

Note that ~/.sbt/build.sbt on Linux corresponds to %USERPROFILE%\.sbt\build.sbt on Windows.

like image 160
Vadzim Avatar answered Oct 07 '22 16:10

Vadzim