0

I have a java web application name webapp,when I export it to a war,the source codes will be compiled to the WEB-INF/classes.

Now I want these classed be compressed to a jar,and put into the WEB-INF/lib.

I have tried this:

create a new java project named webapp_jar.

Copy all the source codes under the webapp/src to the webapp_jar/src,configurate the build path to make the project work.

Add the webapp_jar reference to webapp project.

However ,when I run the webapp,it seems that the classes defined at webapp_jar can not be found.

Is this possible?

BTW,I use the eclipse ee ide.

4

3 回答 3

0

have you try ant https://ant.apache.org/ ? you could make a jar and copy it to folder you want and build the war after. But , if I anderstand, you would package all the app to a jar ? I think your webapp can't work without a servlet or two ...

于 2012-12-12T02:06:23.433 回答
0

This is really easy to do with maven by creating two subject projects, one to build the war, and the other as a jar project and then use the jar project as a dependency on your war project which would put the jar inside the lib directory when packaging the war.

于 2012-12-12T04:50:54.817 回答
0

No I use the Web Deployment Assembly settings in eclipse. I worked.

You can find details here.

于 2012-12-20T00:30:09.417 回答