Maven

Maven Tomcat Run java.lang.ClassCastException: cannot be cast to javax.servlet.Filter

If you get an "cannot be cast to javax.servlet.Filter" exception likwhen running Tomcat from within Maven, or really from anywhere else, then you probably have an older version of the servlet-api defined in your dependencies or (most likely) have a dependency that depends on an older version of the servlet-api.

You can solve this by manually specifying which version to use in your dependency list:


javax.servlet
servlet-api
2.5
provided

Introducing Maven 3 and the Death of the "Unable to find resource" Warnings

One of the most annoying things about Maven 2 was the "Unable to find resource" Warnings. If you used Maven 2, you would have noticed that when you have more than one repository location defined, Maven will give you an "Unable to find resource" Warning on each specified repository until it finds the one that has it. Just as I started switching to Gradle, say hello to Maven 3! (Gradle is a nice build tool, but unfortunately lacks the global configuration abilities and plugin support that Maven currently has)

How to change local maven repository location or IntelliJ .IntelliJIdea90 system cache location

At work we have a windows network log in so our profiles are backed up over the network every time we log in and log out. This is a nice feature, but not so nice when you have a .m2 repo folder and an .IntelliJIdea90 folder in your user home directory. I regularly delete my .m2 repo to test builds, but last time I looked it was quickly approaching 1GB. When trying to diagnose why my Windows log in and out was so slow, I also discovered that my .IntelliJIdea90 system folder was 929 MB as well!

Fix:

Squelch Maven "Unable to find resource" Warnings with Custom Repositories - Check central first

It seems like everyone has their own maven repository these days. The problem with maven, however, is that the more repositories you have, the more locations it checks for a dependencies. Common sense would tell you that the first place maven should look would be maven central, but that is not the case. I suppose there is a rare occurrence where you would not want this, but instead of providing a mechanism for doing that we all get the worst case scenario where central is the last place checked.

Setting up a Maven Repository

To set up a Maven Repository, all you have to do is set up a http browseable web structure similar to your local repository. The simplest way to do this is to set up a subversion repository on a web server and use that. If you don't have a web server, just set up a subversion project on code.google.com and use that.

After you set up your subversion web server. Do a checkout and add your dependencies.

After checking out, create a folder at the same level as braches/tag/trunk called repository.

Eclipse - Hide the Maven Target Directory from Open Resource Shortcut

Okay, there are two Maven plugins for Eclipse: m2eclipse and Q for Eclipse.

I use m2eclipse and I am a big Maven fan.  Unfortunately, I don't want resources to show up from my target directory when I use the open resource shortcut. So how do we get around this?

From what I understand there are three ways to do this.
1. Edit a xml file in the UI jar
2. Use a plugin available from the Eclipse plugin site.
3. Add the "derived" property to the target folder.

Syndicate content