开发者

Why doesn't commenting a dependency in the pom.xml (with m2eclipse) delete the jar in the tomcat server deploy directory?

开发者 https://www.devze.com 2023-02-03 03:50 出处:网络
I started using Maven 2.2.1 and downloaded the latest m2eclipse plugin version 0.12.0. I am using Eclipse 3.5.1 and Tomcat 6.0.26.

I started using Maven 2.2.1 and downloaded the latest m2eclipse plugin version 0.12.0. I am using Eclipse 3.5.1 and Tomcat 6.0.26.

I checked out the mvc-ajax project (in eclipse: File>New>Project>SVN>Project from SVN) and when I ran the server, I came upon the following exception:

org.apache.jasper.JasperException: Unable to read TLD "META-INF/c.tld" from JAR file "file:/tomcatDeployDirectory/mvc-ajax/WEB-INF/lib/jstl-1.2.jar"

which required deleting the jsp-api2.1.jar (as I found out from other posts).

Now I wanted to simply comment the dependency for the jsp-api2.1.jar in the pom.xml and I did that, and the jsp-api2.1.jar vanished from the Maven Dependencies. But once I started the server again, I saw the same exception. I checked the tomcat server deployment directory and I can see the same jsp-api2.1.jar again! I created a new server, but I see the jar there.

Is this a problem with m2eclipse? Do I have some clash between th开发者_JS百科e versions of eclipse maven and m2eclipse? Or should I set something additionally?

Deleting the jsp-api2.1.jar from the server deployment directory did the job, but do I need to do this manually always?

Kind Regards,

Despot


You should call mvn clean, so that your target dir gets cleaned-up.

With m2eclipse you do this from a dialog. Right click the pom file > Run As > Maven Clean

Btw, for the jsp-api dependency, you can set it s <provided>


I've had this happen to me a ton of times. Typically it is because the JAR in question is a transitive dependency of something else (or of multiple items).

Use the "Dependency Hierachy" view in the Eclipse M2Eclipse POM editor and find your JAR on the right hand side...then click on it. On the left hand side you will see all of the dependency paths that led to that JAR being there. You'll have to clip them all off by either commenting them out or adding an "exclude" stanza.

Once this is done, you will HAVE to restart Eclipse. Sorry, but I have never yet seen Eclipse dynamically delete a JAR without restarting it. Perhaps Bozho's tip about cleaning could work, but I'd restart anyway.

Once restarted go into the project explorer and open the "Maven Dependencies" library and look for the JAR. If it is there, go back and continue to try and eliminate the JAR as I mentioned above. If it is gone from the Maven Dependencies library, then you should be good to go.

If it is gone from the project specific Maven Dependencies library, and yet still within the deploy directory then you have the honor of filing a bug with M2Eclipse!

0

精彩评论

暂无评论...
验证码 换一张
取 消