Maven Webjars - bootstrap-datepicker makes bootstrap invisible - maven

I've tried to use Bootstrap and Bootstrap-Datepicker in my SpringMVC project:
GitHub repo
I trying to include both Bootstrap and Bootstrap-Datepicker via WebJars like this:
<!-- WebJars -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
<version>0.1</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap-datepicker</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>1.10.2</version>
</dependency>
When I comment out the bootstrap-datepicker dependency in pom.xml, the browser is throwing errors in the console like this:
GET http://localhost:8080/finager/webjars/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.js 404 (Not Found)
This is working as expected. When I leave boostrap-datepicker section uncommented, the browser starts to see bootstrap-datepicker files, also as expected. Unfortunately, the browser console starts to throw similar errors saying that now Bootstrap files are not visible! It seems that boostrap-datepicker is somehow overriding Bootstrap.
I've tried to change my includes order and still the same effect. All of my .jsp files (CSS and JS includes) seem to be valid, because Bootstrap is visible when Maven does not try to include the datepicker. Is there a simple way to check what is visible in my webjars folder after compilation?
I am very confused. I couldn't find any useful information on the Internet. I've spent whole day on this, so any help would be hugely appreciated. Thanks in advance!

As always, the solution came up to my mind right after posting the question. It seems that Maven detected that bootstrap-datepicker was depending on bootstrap. I suppose that it included Bootstrap in different version in result - that would explain everything.
However, this is the solution:
<!-- WebJars -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
<version>0.1</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap-datepicker</artifactId>
<version>1.3.0</version>
<exclusions>
<exclusion>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.1.0</version>
</dependency>
Is anybody aware of simple solution to browse /webjars directory structure after the Maven compilation? This would prevent such issues.

Related

Getting "Finished Loading Resource Information. Rendering Swagger UI..." on loading swagger after migration from spring to sprinboot

We just migrated our application from Spring to Sprinboot (2.7.0). whenever i load swagger, all the apis dont get loaded and i get this line "Finished Loading Resource Information. Rendering Swagger UI..." on the top.
But http://host:port/v2/api-docs loads all the apis.
earlier we have below swagger related dependencies in our pom.xml
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${version.io.springfox}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.8</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.6.8</version>
</dependency>
dependencies. I tried with that, i got same issue.
Later i tried adding springfox-boot-starter dependency and commenting out specific swagger based spring dependencies but no luck. I tried to search for a solution but couldnt find anything concrete.
Any idea why this is happening?

JSF correct use of jsf-api dependency

Ok, I am a little confused on the differences between jsf-api implementations.
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.8</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1</version>
</dependency>
I am not sure what the differences are between these two. I thought they do the same thing and allow the javax.faces imports but now I have confused myself. Can anyone please explain these two differences? Thanks :)
There was somes changes with the groupId of the Maven JSF-API dependency since the first version. For JSF 2.2 (current version as I'm writing this), you should use the following recommended dependency, if you are running in a container supporting JSF:
<dependency>
<groupId>javax.faces</groupId>
<artifactId>javax.faces-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
If your container does not support JSF (like Tomcat), use the following dependency if you want to use Mojarra (the default JSF implementation):
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.2.8</version>
</dependency>
Other recommmendation and information are available on the official page of JSF.

Onejar-maven-plugin to set the order of jar loading

I've been using the library apache-log4j-extras for logging. It contains class org.apache.log4j.Logger.
Now I had to reference some 3rd party library, that uses logback and has among its dependencies log4j-over-slf4j (jar). Unfortunately, latter jar also contains class org.apache.log4j.Logger.
Looks like the latter class is preferred by the onejar classloader...
I don't need logback and log4j-over-slf4j. Just want my org.apache.log4j.Logger from apache-log4j-extras back. What are my options with the Onejar-maven-plugin?
EDIT: It appeared to be an issue with Debug mode in IDEA, not with onejar. However the question is still relevant: how can I ensure that I load the requried class with Onejar?
EDIT2: E.g. in C# it could be easily resolved with "extern alias" feature.
why don't you just exclude it?
<dependency>
<groupId>my.naughty.thirdparty</groupId>
<artifactId>thirdparty-with-log4j-over-slf4j</artifactId>
<version>${thirdparty.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
Looks like (for Debug mode in IDEA) just switching depenencies order solved the issue.
How it was:
<dependency>
<groupId>my.naughty.thirdparty</groupId>
<artifactId>thirdparty-ref-log4j-over-slf4j</artifactId>
<version>0.50</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>apache-log4j-extras</artifactId>
<version>1.1</version>
</dependency>
Changed to:
<dependency>
<groupId>log4j</groupId>
<artifactId>apache-log4j-extras</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>my.naughty.thirdparty</groupId>
<artifactId>thirdparty-ref-log4j-over-slf4j</artifactId>
<version>0.50</version>
</dependency>
But surely I can't consider it as a robust solution, especially for Onejar.

Can not find the tag library descriptor for "http://tiles.apache.org/tags-tiles"

I am creating an application using Tiles, Spring and Hibernate.
When when running, it is showing following error:
Can not find the tag library descriptor for "http://tiles.apache.org/tags-tiles"
All the jars are included and mapping is also seeing fine. Where I am going wrong?
The url looks ok.
Your problem sounds a bit like you are missing some tiles jars. Make sure that a jar containing tiles-jsp.tld is added to your projects web libs folder.
One jar that contains this file is for example: tiles-jsp-2.2.1.jar.
In pom.xml file appended below artifacts and compiled well this time.
<!-- Tiles -->
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-api</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-core</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-servlet</artifactId>
<version>2.1.2</version>
</dependency>
I copied the whole file with the taglib declaration from somewhere else and got the same compilation error. I deleted the file, created a new one and pasted the same contents. Sounds weird but worked! Hope it helps someone. :)
I had this problem even after having tiles-jsp.2.0.6.jar. So i found the solution by removing the jar manually from the maven dependencies and adding it as an external jar.. It worked, you may also try so..
Adding the tiles dependency in pom.xml of Spring project will help-
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>3.0.7</version>
</dependency>

Where can I find spring-ldap 1.3.1-RELEASE maven repo

1.2.1 is available, i can get it by
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap</artifactId>
<version>1.2.1</version>
</dependency>
but I can't get the latest build. I have used
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap</artifactId>
<version>1.3.1.RELEASE</version>
</dependency>
I am interested in using the authenticate method of LdapTemplate.
It looks like now they want you to declare dependencies on individual modules.
However, the single module is still there, but you need to use classifier to access it:
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap</artifactId>
<version>1.3.1.RELEASE</version>
<classifier>all</classifier>
</dependency>
It is available in the below link
You can download it here

Resources