My question is that i am not sure how to refer to the bootstrap lib which is in the 'External Libraries' in my project.
In the build.gradle file i added:
compile group: 'org.webjars', name: 'bootstrap', version: '3.3.7'
so the bootstrap library was downloaded.
But when i want to refer to it in a html file, and try to use the copy path function, i get this:
C:\Users\Michael\.gradle\caches\modules-2\files-2.1\org.webjars\bootstrap\3.3.7\d6aeba80236573ed585baa657dac2b951caa8e7e\bootstrap-3.3.7.jar!\META-INF\resources\webjars\bootstrap\3.3.7\css\bootstrap.css
Also tried this 'standart' path (wasnt working):
<link rel="stylesheet" href="../css/bootstrap.min.css">
I am using Intellij ( gradle project )
Gradle downloads and cahces dependecies locally. It references the artifacts from the cache whenever needed, the IDE, the compiler all get a path to the artifact from the cache.
The reference that you ended up including refers the file from within the archive in the cache. This is not something the browser understands.
You need to use a Copy Task to place it somewhere in your project where you will be able to access it, or package it together with the rest of your website.
Copying a specific dependency is already addressed.
You will need to additionally extract the artifact. The documentation has examples on how to read archive contents.
Here's what a complete solution might look like:
apply plugin: "java"
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.webjars', name: 'bootstrap', version: '3.3.7'
}
task copyBootstrap(type: Copy) {
configurations.compile
.files({ it.group.equals("org.webjars")})
.each {
from zipTree(it)
}
into "$buildDir/static_resources"
}
This puts the file you are looking for at the following location on my system (Gradle 2.14.1):
build/static_resources/META-INF/resources/webjars/bootstrap/3.3.7/css/bootstrap.min.css
In case you want to extract the specific file only or get rid of the version number to make it easier to refer to that's also possible.
Note that it's a good idea to extract in $buildDir
since with most plugins, including java, it's cleaned up automatically by the Clean task, and it's harder to accidentally commit.