Referenced libraries that are not deployed by Eclipse

I am setting up a Google App Engine project in Eclipse. I added a root level folder to contain libraries for my project. I have added all of these libraries to the build path for my project. The code compiles without any errors. When I start a project, I get errors when starting NoClassDef. When I manually add these libraries to the directory of the military catalog directory, these errors disappear.

Why doesn't Eclipse deploy libraries in my build path for me? Do I need to have a script construct to run Eclipse? Build a script that will copy my libraries to the dir lib war folder?

+4
source share
3 answers

For standard Java EE projects, libraries should be located in the {web-app} / WEB-INF / lib folder . GAE requires them to be there to load code into the engine.

Alternatively, you can use Maven to determine your dependencies and deployments for GAE

UPDATE: The GAE project follows the standard Java EE project structure for creating and deploying a war file. The convention is that your lib folder is located in {web-app} / WEB-INF / lib. A Google plugin automatically generates such a structure (an example from the plugin documentation):

MyTestProject src/ log4j.properties META-INF/ jdoconfig.xml com/ mytestproject/ MyTestProjectServlet.java war/ index.html WEB-INF/ appengine-web.xml web.xml logging.properties classes/ lib/ ...App Engine JARs... 

The plugin allows you to change the location for your "military" directory, but not the location of your libraries, since it must comply with the Java EE standard.

+3
source

You can directly add libraries to your war / library, and then right-click on libraries to add them to your build path.

Not sure why it does not deploy libs in the build path, but I have been working with Eclipse for many years and always did it the way I described. Then I just deploy through eclipse and don't use the script construct.

+2
source

If a library that has not been added to the lib folder is being developed in the same workspace, I would suggest including the Utility Module facet in the project properties of the library project. Sometimes Eclipse does not copy the jar to the WEB-INF / lib folder, even if the deployment build and everything else were configured correctly.

+2
source

Source: https://habr.com/ru/post/1342337/


All Articles