Intellij IDEA + SBT: skip download errors for non-existing Sources/Javadocs - intellij-idea

In Intellij IDEA (2016), with Download: Sources and Javadocs enabled, (can't insert image inline due to lack of reputation)
SBT will attempt to download Sources and Javadocs for all dependencies, whether or not they exist.
Problem is, when a dependency (or worse, nested dependency) does not have a Source/Javadoc, the build will fail.
Is there any way to configure IDEA/SBT to check and skip downloading Sources/Javadocs if it does not exist, or ignore errors when downloading Sources/Javadocs, without having to append
withSources() withJavadoc()
to every dependency?
For example, a dependency relying on Antlr 2.7.7, which does not have Javadocs (antlr-2.7.7-javadoc.jar) in Maven Central (https://repo1.maven.org/maven2/antlr/antlr/2.7.7/), with Download: Javadoc enabled, will return error:
SBT project import
[warn] [FAILED ] antlr#antlr;2.7.7!antlr.jar(doc): (0ms)
[warn] ==== local: tried
[warn] C:\Users\Daniel\.ivy2\local\antlr\antlr\2.7.7\docs\antlr-javadoc.jar
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/antlr/antlr/2.7.7/antlr-2.7.7-javadoc.jar
[warn] ==== activator-launcher-local: tried
[warn] C:\Users\Daniel\.activator\repository\antlr\antlr\2.7.7\docs\antlr-javadoc.jar
[warn] ==== activator-local: tried

In Idea Settings > Build ... > Build Tools > sbt: uncheck Download Library sources and sbt sources

Related

sbt.compiler.EvalException: Type Error in Expression

I'm quite new with IntelliJ (and on this site too tbh) and have been using it for only a couple of days. When I tried to build my project this exception came up. I tried to solve the problem but to no avail. I tried to see if the same problem occured on a newly created project and yes it does. So the code I've written should have no influence on the build. IƤve also checked if there might be a problem with the sbt version but I am up to date.
This is what the error looks like. I have absolutely no clue how to solve this so any help would be very much appreciated.
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[warn] Executing in batch mode.
[warn] For better performance, hit [ENTER] to switch to interactive mode, or
[warn] consider launching sbt without any commands, or explicitly passing 'shell'
[info] Loading global plugins from C:\Users\Johner-Institut\.sbt\0.13\plugins
Waiting for lock on C:\Users\Johner-Institut\.ivy2\.sbt.ivy.lock to be available...
[info] Loading project definition from C:\Users\Johner-Institut\Desktop\Project\project
C:\Users\Johner-Institut\Desktop\Project\build.sbt:5: error: recursive value project needs type
lazy val `project` = (project in file(".")).enablePlugins(PlayScala)
^
sbt.compiler.EvalException: Type error in expression
[error] sbt.compiler.EvalException: Type error in expression
[error] Use 'last' for the full log.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
Don't use project as a name for sbt project, that's why the recursion error. Try something like:
lazy val root = (project in file(".")).enablePlugins(PlayScala)

ScalaJS Project: SBT dependency on Leaflet not resolved

I have a ScalaJS project built in IntelliJ with SBT in which I'd like to include a slippy map based on the Leaflet library.
I'm using ScalaJS version 0.6.19 and SBT version 0.13.7
My build.sbt is the following:
import com.lihaoyi.workbench.Plugin.{bootSnippet, updateBrowsers}
enablePlugins(ScalaJSPlugin)
workbenchSettings
name := "WeatherReport"
version := "0.1-SNAPSHOT"
scalaVersion := "2.11.11"
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "0.9.1"
,"org.scala-js" %%% "scalajs-java-time" % "0.2.2"
,"com.lihaoyi" %%% "scalatags" % "0.6.5"
,"org.webjars.npm" %%% "leaflet" % "0.7.7"
)
bootSnippet := "com.sap.demo.WeatherReport().main(document.getElementById('weatherDiv'));"
updateBrowsers <<= updateBrowsers.triggeredBy(fastOptJS in Compile)
This was all working fine until I added the last dependency on leaflet. Now SBT complains:
Error:Error while importing SBT project:
...
[info] Resolving org.eclipse.jetty#jetty-util;8.1.16.v20140903 ...
[info] Resolving org.eclipse.jetty#jetty-io;8.1.16.v20140903 ...
[info] Resolving org.eclipse.jetty#jetty-http;8.1.16.v20140903 ...
[info] Resolving org.eclipse.jetty#jetty-server;8.1.16.v20140903 ...
[info] Resolving org.eclipse.jetty.orbit#javax.servlet;3.0.0.v201112011016 ...
[info] Resolving org.eclipse.jetty#jetty-continuation;8.1.16.v20140903 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.webjars.npm#leaflet_sjs0.6_2.11;0.7.7: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] org.webjars.npm:leaflet_sjs0.6_2.11:0.7.7 (/Developer/Scala/weather-report/build.sbt#L13-19)
[warn] +- weatherreport:weatherreport_sjs0.6_2.11:0.1-SNAPSHOT
[trace] Stack trace suppressed: run 'last *:ssExtractDependencies' for the full output.
[trace] Stack trace suppressed: run 'last *:update' for the full output.
[error] (*:ssExtractDependencies) sbt.ResolveException: unresolved dependency: org.webjars.npm#leaflet_sjs0.6_2.11;0.7.7: not found
[error] (*:update) sbt.ResolveException: unresolved dependency: org.webjars.npm#leaflet_sjs0.6_2.11;0.7.7: not found
[error] Total time: 1 s, completed 31-Aug-2017 10:26:54
As fas a I can tell from the leaflet entry on the WebJars website, I've got the group/artifact/version information correct.
I'm not clear on why the error message has added "_sjs0.6_2.11" to the library name. Is this because there needs to be some version of leaflet specific to ScalaJS?
Thanks
Chris W
Your are confusing Webjars, which are .jars containing .js libraries published on Maven, with Scala.js libraries, which also .jars published on Maven, but containing Scala.js' .sjsir files.
Depending on the JS libraries in Webjars is typically done with jsDependencies in a Scala.js sbt build, not with libraryDependencies. Therefore, they should also use % instead of %%%. For example:
jsDependencies += "org.webjars.npm" % "leaflet" % "0.7.7" / "dist/leaflet.js"
Now you will probably also want Scala.js facades to talk to Leaflet using static types. Fortunately for you, such a facade library already exists. Since a facade library is a Scala.js library (as opposed to a JS library in a Webjar), that would be specified in libraryDependencies, with %%%. However it seems that that particular library is not (yet) published on Maven Central, so you might have to locally publish it yourself.

Junit not working on SBT in Play! Framework project on Intellij 14

i'm having some troubles with tests in Intellij, i created a new project with
activator new my-project
then opened that projected with intellij, i marked all boxes for SBT to auto-download and create empty folders, etc.
Well after the project is opened and loaded all SBT stuff i have some errors.
First with versions:
SBT project import
[warn] Multiple dependencies with the same organization/name but different versions. To avoid conflict, pick one version:
[warn] * org.apache.httpcomponents:httpclient:(4.0.1, 4.3.4)
[warn] * com.google.guava:guava:(18.0, 16.0.1)
[warn] * junit:junit:(4.12, 4.11)
[warn] * org.apache.httpcomponents:httpcore:(4.0.1, 4.3.2)
[warn] * commons-logging:commons-logging:(1.1.1, 1.1.3)
[warn] * org.scala-lang.modules:scala-parser-combinators_2.11:(1.0.1, 1.0.3)
[warn] * org.scala-lang.modules:scala-xml_2.11:(1.0.1, 1.0.3)
then with the junit
i looked up and there is some solutions to the vesion problem, but they didn't work for me and i have nothing about the junit thing.
Tests work on terminal but i can't have markdown in intellij
There are indeed some conflicting dependencies with some of the libraries.
To work around the JUnit conflict, you can add:
"junit" % "junit" % "4.12" % "test"
to the libraryDependencies in build.sbt.

Maven : Parent project not resolved, transitive dependencies not used for compiling

After searching and trying a lot of things I need a Maven maven :)
So, my problem is that on my development box (which is Windows 2003) I can build my maven project, but on the Bamboo server (x86_64 x86_64 x86_64 GNU/Linux) it fails because one of the modules doesn't have a library and the compiling doesn't find a class.
The class is found in a transitive dependency, dependency that it seems to me that is not resolved.
I've run the command "mvn -X clean install" on both boxes and compared the output.
The only change I think it's relevant is
On dev-box
[DEBUG] Retrieving parent-POM: pl.com.abg.iacsro:sapscndp-claimprocessing:pom:1.0-SNAPSHOT for project: pl.com.abg.iacsro:sapscndp-claimprocessing-api:jar:DEV2010 from the repository.
On Bamboo box
[DEBUG] Retrieving parent-POM: pl.com.abg.iacsro:sapscndp-claimprocessing:pom:1.0-SNAPSHOT for project: null:sapscndp-claimprocessing-api:jar:DEV2010 from the repository.
It seems to me that maven doesn't resolve the parent of the module, because later in the build process I've seen (on Bamboo box)
[WARNING] POM for 'pl.com.abg.iacsro:sapscndp-claimprocessing-api:pom:DEV2010:provided' is invalid.
Its dependencies (if any) will NOT be available to the current build.
[DEBUG] Reason: Failed to validate POM for project pl.com.abg.iacsro:sapscndp-claimprocessing-api at Artifact [pl.com.abg.iacsro:sapscndp-claimprocessing-api:pom:DEV2010:provided]
Validation Errors:
[DEBUG] 'dependencies.dependency.version' is missing for pl.com.abg.iacsro:systemcore-jobs-api:jar
[DEBUG] 'dependencies.dependency.version' is missing for pl.com.abg.iacsro:workflow-crossconflictresolution-api:jar
[DEBUG] 'dependencies.dependency.version' is missing for pl.com.abg.iacsro:iacs-commons-objectfactory:jar
[DEBUG] 'dependencies.dependency.version' is missing for ro.siveco.iacsro:farmerregistry-api:jar
I've also found this
[WARNING] POM for 'pl.com.abg.iacsro:sapscndp-claimprocessing-api:pom:DEV2010:provided' is invalid.
but I've checked and validated myself the pom of the dependency against the xsd, so the pom is valid.
Do you have any idea how to resolve this ?
Many thanks!
P.S. : In case maybe I've overlooked something, here's the full listing from the Bamboo box http://dl.dropbox.com/u/402296/install.txt
When I see such an entry:
[DEBUG] Connecting to repository: 'Artifactory-internal-repository' with url: 'http://192.168.0.59:8081/artifactory/repo'.
Downloading: http://192.168.0.59:8081/artifactory/repo/pl/com/abg/iacsro/onthespotcheck/1.0-SNAPSHOT/onthespotcheck-1.0-SNAPSHOT.pom
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[DEBUG] Artifact resolved
[WARNING] POM for 'pl.com.abg.iacsro:onthespotcheck-checks-api:pom:DEV2009_2:provided' is invalid.
I'm tempted to ask if there is anything particular to say about onthespotcheck-1.0-SNAPSHOT.pom?
As a side note, you have a bunch of:
for project: null:artifactId:version
that I find pretty weird. Why is the groupId null? Anything worth to mention about your pom?

The container 'Maven Dependencies' references non existing library

I use SpringSource Tool Suite 2.3.0. Recently I added the commons-compress dependency to pom.xml as required by jackrabbit 2.0 dependency. Updating maven dependencies console shows:
"Missing artifact org.apache.commons:commons-compress:jar:1.0:compile"
I checked the Problems view and it shows the following error:
The container 'Maven Dependencies' references non existing library 'C:\Documents and Settings\AElshereay.m2\repository\org\apache\commons\commons-compress\1.0\commons-compress-1.0.jar'.
Also:
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'config:simple'.
I have no idea what is that last! And if it has anything to do to not download the mentioned jar from maven repository even it's there!
Please, can anyone help me to resolve this problem?
Thank you in advance.
I'm not 100% sure about the last error message but the two first one are definitely related: you declared a dependency to the POM so the .classpath is updated to point on it in your local repository but the file is can't be find in it and Eclipse/STS complains about this.
Now, I tried to declare the commons-compress dependency in a POM:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.0</version>
</dependency>
And, while I can see some complains about checksum validations:
1/23/10 5:11:10 AM CET: Downloading central : org/apache/commons/commons-compress/1.0/commons-compress-1.0.pom
1/23/10 5:11:10 AM CET: Downloaded [central] -> http://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.0/commons-compress-1.0.pom
1/23/10 5:11:10 AM CET: [WARN] *** CHECKSUM FAILED - Checksum failed on download: local = '325980a09dbbd0c108ece8e7733b462b00e6f2a8'; remote = 'commons-compress-1.0.pom:' - RETRYING
1/23/10 5:11:10 AM CET: Downloading central : org/apache/commons/commons-compress/1.0/commons-compress-1.0.pom
1/23/10 5:11:10 AM CET: Downloaded [central] -> http://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.0/commons-compress-1.0.pom
1/23/10 5:11:11 AM CET: [WARN] *** CHECKSUM FAILED - Checksum failed on download: local = '325980a09dbbd0c108ece8e7733b462b00e6f2a8'; remote = 'commons-compress-1.0.pom:' - IGNORING
1/23/10 5:11:12 AM CET: Downloading central : org/apache/commons/commons-compress/1.0/commons-compress-1.0.jar
1/23/10 5:11:15 AM CET: Downloaded [central] -> http://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.0/commons-compress-1.0.jar
1/23/10 5:11:16 AM CET: [WARN] *** CHECKSUM FAILED - Checksum failed on download: local = '995ae384a0b1e2c66269e6bc5198db8561fb45a2'; remote = 'commons-compress-1.0.jar:' - RETRYING
1/23/10 5:11:16 AM CET: Downloading central : org/apache/commons/commons-compress/1.0/commons-compress-1.0.jar
1/23/10 5:11:18 AM CET: Downloaded [central] -> http://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.0/commons-compress-1.0.jar
1/23/10 5:11:18 AM CET: [WARN] *** CHECKSUM FAILED - Checksum failed on download: local = '995ae384a0b1e2c66269e6bc5198db8561fb45a2'; remote = 'commons-compress-1.0.jar:' - IGNORING
The artifacts gets downloaded.
So please check that you didn't configure the central repository with a checksumPolicy
set to fail. Look for something like that in your settings.xml or in global settings used by m2eclipse (Windows > Preferences > Maven > Installations) or in a project profile:
<checksumPolicy>fail</checksumPolicy>
If you can't find anything like that, then a workaround would be to install commons-compress manually.