I'm using Spark as framework to build a Java web server and rely on Bootstrap and jQuery for frontend. I'm using Webjars to bring dependencies in my pom.xml
.
The problem omes with importing static files. While importing Bootstrap's CSS and JS files works well, it doesn't for jQuery JS file. I import the static files using staticFileLocation("/META-INF/resources");
and HTML header contains:
<link rel="stylesheet" href="webjars/bootstrap/3.3.6/css/bootstrap.min.css">
<script type="text/javascript" src="webjars/jquery/2.2.1/jquery.min.js"></script>
<script type="text/javascript" src="webjars/bootstrap/3.3.6/js/bootstrap.min.js"></script>
webjars/bootstrap/3.3.6/css/bootstrap.min.css
and webjars/bootstrap/3.3.6/js/bootstrap.min.js
routes work well but webjars/jquery/2.2.1/jquery.min.js
answers 404.
Somehow, it looks like jQuery JS file isn't present in classpath. Any clue what I'm missing ?
Edit:
The pom.xml
dependencies are the following:
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.6</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>2.2.1</version>
</dependency>
Edit 2:
I also call staticFileLocation()
two times in my controller:
staticFileLocation("/static");
staticFileLocation("/META-INF/resources");
The two calls seem to conflict with each other.