Tomcat does not get the right jar

I am developing a web project using Eclipse Juno, Tomcat 7 and Maven 3 and am facing an incomprehensible problem.

I have a separate project in which I collect some things, and I select this jar in my web project as a dependency. So, the end result is one .war. Now, when I launch this war in the built-in Tomcat in Eclipse and press the update button in my browser, Tomcat says that it cannot find the path in this bank.

In the working folder WEB-INF / lib I find myApplication-common-widgetset-0.0.11-20130926.124257-7.jar

In the Tomcat deployment directory in wtpwebapps / myApplication / WEB-INF / lib I see myApplication-common-widgetset-0.0.11-SNAPSHOT.jar It's strange that the file under Tomcat lib is 1kb in size and the file in my workspace lib is ~ 22Mb .

I tried to copy a jar of workspace into the Tomcat lib folder, and everything works and starts up like a charm.

Update:

  • When I run mvn tomcat:run from the command line in my workspace, everything works.
  • I “reinstalled” both Eclipse (in Kepler, wiping everything, including workspace and home folders) and Tomcat 7. I still have the same problem.
  • Colleges tried to extract my project from SVN and successfully started it, both with Eclipse and IntelliJ + Tomcat 7

What could happen? Why doesn't the Eclipse embedded Tomcat get everything from the target directory?

+8
eclipse maven tomcat maven-3 tomcat7
source share
1 answer

The problem I am thinking about is the reality that the eclipse does not strictly observe maven dependencies.

This is because eclipse does not delay on maven when creating, deploying, and running on tomcat. Eclipse will use your local workspace setting and thus sometimes introduce a dependency tree other than maven.

From the information you provided, it looks as if the lib of the working environment was one of the sources from the maven repository, and the one that was built into the tomcat deployment directory is the jar that the eclipse built - I assume here.

If this jar is from a workspace project, you can try closing the project and let eclipse find the jar from maven.

This problem with Eclipse and Maven is rather foggy, and therefore it is difficult to understand what is happening in terms of dependencies, so sorry, I can no longer help

0
source share

All Articles